Description
I'm using the new Ember 3.7 routerService to build the browser's history in js-land for the purposes of showing nav back/forward buttons (think iOS app nav buttons).
One issue I'm facing is when to detect that a routeDidChange
was the consequence of a browser back/forward event.
This can be known if I hook into the window.onpopstate
event, but unfortunately, this fires after routeDidChange
.
So, I've delved into the transition object in the hope of some clue as to whether a specific transition was browser initiated rather than a usual ember routing event.
It seems that transition.urlMethod
may be this, from my limited testing it seems that transition.urlMethod
will be null
when a browser back/forward action triggered the transition and I can therefore use a null value as a indication that some kind of back/forward was used.
I've searched the codebase to see whether this is a safe assumption, but it seems that none of the comments specifically identify this.
So my question is... can I safely use transition.urlMethod
to indicate in my code that a transition was not triggered by Ember and therefore is likely a browser-triggered back/forward transition?
Activity