onroutechange
v0.0.6
Published
Listen to route changes for single-page applications.
Readme
onroutechange
The polyfill enables you to listen to route changes by customized window.onroutechange callback.
It's quite similar to window.onhashchange API, but for history.pushState. Could be useful for single-page applications.
Usage
Step1. Insert the following script tag into your webpage:
<script src="https://unpkg.com/onroutechange/dist/onroutechange.min.js"></script>Step2. Register the window.onroutechange callback, for example:
window.onroutechange = function(state) {
console.log('Route updated!');
};License
MIT
