Closed Guria closed 9 years ago
Thanks for the suggestions and thinking "out of the box" :-)
I have a feeling we just have to expose a method for this, as your first suggestion. But lets play with this some more first.
addressbar.value = {
url: newUrl,
replace: true
};
Which could also be used to:
addressbar.value = {
url: newUrl,
replace: true,
hash: true,
query: myQuery
};
I kinda like this, as it opens up even new doors. What do you think?
Hmm. I like this. Should we still support string values?
Hm, good question. My initial thought is "yes". That is like default behaviour. But since this is somewhat a magic input it also supports an object as a value :-)
There is another question: console.log(addressbar.value)
?
Ok, I think then addressbar.value
is string by default, but accepts object in setter?
That is also a good point. I think actually we should return the string now. To avoid any migration issues. Then we get some experience with it and can make a better decision on maybe stripping out strings completely or other alternatives.
@christianalfoni I think I'll leave this task for you. I am afraid I will not write adequate tests in this project in short time.
if (typeof value === "object") {
doReplace = !!value.replace;
value = value.url;
}
Cool, lets conclude with allowing an object to be set like this:
addressbar.value = {
value: url,
replace: true
}
To force replacing the url. This allows for expanding and does not require any migration path. I will make this part of the next cerebral-router
release package :-)
we need it before router new relese so we could test routers redirect
Jup, will do that
Okay, got it running with test and updated documentation
released
variant 1
variant 2
variant 3