We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I think that Pushstate should work independent of can-route, but it does not. For example, a codepen like this does not work:
Pushstate
can-route
https://codepen.io/justinbmeyer/pen/MzGyPb?editors=1011
This is because:
root
if (route.rule(url) !== undefined) {
#1 can be solved by letting people pass the "root" into new RoutePushstate().
#1
"root"
new RoutePushstate()
#2 is tricker. We could allow people to pass in if the "url" should be handled.
#2
new RoutePushstate({ root: "/", usePushstate(){ return true; // All links will use pushstate } })
I think we should enable this sort of flexibility now. It will make issues like canjs/canjs#4448 easier to tackle.
For backwards compatibility, we will just make the constructor default to:
new RoutePushstate({ root: function(){ bindingProxy.call("root") }, usePushstate(){ return true; // All links will use pushstate } })
The other place it is used is when setting the value of the observable (obs.set("/some/url")).
obs.set("/some/url")
Currently, set(){} uses route.deparam() to diff which keys are changing and optionally call replaceState instead of pushState.
set(){}
route.deparam()
replaceState
pushState
Do we need this functionality? Should we expect people to call these themselves? We could have additional configuration like:
new RoutePushstate({ historyMethod(path) { return CHECK_PATH ? "pushState" : "replaceState" } })
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I think that
Pushstate
should work independent ofcan-route
, but it does not. For example, a codepen like this does not work:https://codepen.io/justinbmeyer/pen/MzGyPb?editors=1011
This is because:
Pushstate
calls intocan-route
to know theroot
(which is going to be #!)if (route.rule(url) !== undefined) {
#1
can be solved by letting people pass the"root"
intonew RoutePushstate()
.#2
is tricker. We could allow people to pass in if the "url" should be handled.I think we should enable this sort of flexibility now. It will make issues like canjs/canjs#4448 easier to tackle.
For backwards compatibility, we will just make the constructor default to:
The other place it is used is when setting the value of the observable (
obs.set("/some/url")
).Currently,
set(){}
usesroute.deparam()
to diff which keys are changing and optionally callreplaceState
instead ofpushState
.Do we need this functionality? Should we expect people to call these themselves? We could have additional configuration like:
The text was updated successfully, but these errors were encountered: