on-url-change
v1.0.2
Published
Listen to url change events
Downloads
7,478
Readme
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.