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.

Readme

Keywords

none

Package Sidebar

Install

npm i on-url-change

Weekly Downloads

1,678

Version

1.0.2

License

ISC

Last publish

Collaborators

  • korynunn