on-url-change

1.0.2 • Public • Published

on-url-change

Listen to url change events

Why

There is no API for this, sadly.

Emits 'change' event on pushState or hash-change.

Usage

 
var onUrlChange = require('../');
 
var emitter = onUrlChange(/* Optional interval, default 50ms */);
 
emitter.on('change', function(url){
    console.log('URL changed to: ', url);
});
 

Tests

More like an example.

You need to run the page in a static server, due to file-system security issues.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    3,606
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    3,606
  • 1.0.1
    2
  • 1.0.0
    2

Package Sidebar

Install

npm i on-url-change

Weekly Downloads

1,761

Version

1.0.2

License

ISC

Last publish

Collaborators

  • korynunn