Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flow service: add support for "real" urls #366

Closed
alex3683 opened this issue Sep 1, 2016 · 2 comments
Closed

flow service: add support for "real" urls #366

alex3683 opened this issue Sep 1, 2016 · 2 comments
Assignees
Milestone

Comments

@alex3683
Copy link
Member

@alex3683 alex3683 commented Sep 1, 2016

Up to now LaxarJS only supports routing based on url anchors. The new routing library page.js already supports real url based routing and the methods of the flow service already try to abstract from the underyling method of routing. Nonetheless in reality hash-based routing is still expected and a constructAnchor() method is explicitly provided for this. The constructAbsoluteUrl() also uses this method to create absolute urls for links.

Long story short: constructAnchor() should be removed and constructAbsoluteUrl() should create a url that fits the configured type of routing. constructPath() should be fine and create urls that fit either type of routing. Nevertheless there is no need that this method is public, since it only makes any sense if the underlying routing library is known and publicly accessible.

@x1B

This comment has been minimized.

Copy link
Member

@x1B x1B commented Sep 23, 2016

Implemented on master (v2.0).

BREAKING CHANGE

The API of the widget injection axFlowService has changed. Previously there were three methods:

  • constructPath( placeOrTarget, params ) to obtain the part of the a place's URL that is local to the configured routing setup (e.g. the stuff after #! if using hashbang URLs).
  • constructAbsoluteUrl( placeOrTarget, params ) to calculate an absolute URI including path and hashbang-suffix, for use in a tags. Only worked correctly if hashbang URLs were used.
  • constructAnchor( placeOrTarget, params ) to calculate the hash-based link for use in a tags, without path prefix. Only useful if hashbang URLs were used.

The whole point of the declarative flow is that widgets should be portable across different routing scenarios. So, the same widgets should work equally well independent of wether HTML5 URLs or hash fragments are used for routing. Also, in REST-philosophy, URLs should be opaque: Widgets should not try to build URLs from a path suffix.

For this reason, now only one method remains:

  • constructAbsoluteUrl( placeOrTarget, params ) calculates an absolute URL for the given place, independently of the current router setup. Widgets should use this method instead of any of the above methods.
@x1B x1B closed this Sep 23, 2016
@x1B

This comment has been minimized.

Copy link
Member

@x1B x1B commented Nov 7, 2016

Updated upgrade information after #387

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.