I am trying to implement History.js after learning to use the History API. However my popstate isn’t working anymore.
What is used in the History.js as the onpopstate? In the history API you use onpopstate with event.state.
What I need to know is what is used in History.js. Is it window.onstatechange and what does it return?
You can’t tell it’s from push or pop. This is by its design.
You should not do anything before push event. Instead, you should pass all your required data to the first parameter.
Then retrieve data from onstatechange and do some actions.
Check this: https://github.com/browserstate/history.js/issues/47