hashwatch
v1.0.0
Published
listen for hashchange events in all browsers, even ie 6
Readme
hashwatch
This module lets you listen for hashchange events in all browsers, even those that don’t emit the hashchange event.
** The tests should pass in all browsers, even IE 6 and friends! **
Install
$ npm install hashwatchUsage
var watch = require('hashwatch')(handler)
function handler () {
console.log('The hash is now ' + location.hash)
console.log('so let’s stop listening for a bit…')
watch.pause()
setTimeout(function () {
console.log('Okay, let’s pick things back up…')
watch.resume()
}, 1000)
}Page weight
require('hashwatch')
| compression | size | | :------------------ | ------: | | hashwatch.js | 1.37 kB | | hashwatch.min.js | 980 B | | hashwatch.min.js.gz | 480 B |
Running the tests
Until testling comes back (or is replaced by something elegant) you can run the tests yourself in any browser:
$ git clone [email protected]:michaelrhodes/hashwatch
$ cd hashwatch
$ npm install
$ npm test