Open ergo opened 7 years ago
@ergo A safe way to change path is to do the following
switchPath: function(path, params) {
window.history.pushState({}, null, this.generateUri(path,params));
window.dispatchEvent(new CustomEvent('location-changed'));
},
This is push the new url and then dispatch the location-changed
event. <iron-location>
and then in turn <app-location>
see that and respond - setting up the route for <app-route>
. I have this function in a behaviour which gets included in many elements. It doesn't need any centralised management (<iron-location>
is in effect doing that)
Note the generatURI
function just encodes the params
object as query parameters and appends it to path
Isn't it supposed to be used with app-location
in the form of:
<app-location route="{{route}}" query-params="{{queryParams}}"></app-location>
<app-route route="{{route}}" pattern="[[rootPattern]]:page" data="{{routeData}}"></app-route>
ping?
> $0.queryParams === $0.route.__queryParams
true
Hello,
I'm dispatching some events in form of:
Now I'm receiving them in my top level document:
However double underscores don't give confidence if this API should be accessed by me at all. Can we get some confirmation if it will be safe for us to use?