isiahmeadows
2020-04-16
Currently, we only have onpopstate
, and that event only fires on user-generated events. While this is fine if you encapsulate everything to just one history library and do everything through it, it doesn’t let people use history.pushState(someURL)
while also using a routing library, for example.
How about a historychanged
event that fires on every history change? This would be after the navigation changes, and the event object itself would have two properties, previousPath
and previousState
, each self-descriptive. This would fire any time the location changes without attempting navigation.