history-state allows you to monitor and make changes to a page’s history state.
$ npm install history-state
By default, the mechanisms used are
window.onpopstate, with older browsers falling back to
window.onhashchange. This behaviour can be overridden by passing the constructor an options object, detailed below.
var state =// Use only location.hash/onhashchange…hash: true// …or use only history.pushState/onpopstate.pushState: truestatestate// Toggle the window listeners.statestatestart