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,
previousState, each self-descriptive. This would fire any time the location changes without attempting navigation.