onroutechange

0.0.6 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i onroutechange

Weekly Downloads

1

Version

0.0.6

License

MIT

Unpacked Size

7.1 kB

Total Files

9

Last publish

Collaborators

  • ajhsu