1.0.0 • Published 8 years ago

hashwatch v1.0.0

Weekly downloads
20
License
MIT
Repository
github
Last release
8 years ago

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 hashwatch

Usage

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')

compressionsize
hashwatch.js1.37 kB
hashwatch.min.js980 B
hashwatch.min.js.gz480 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 git@github.com:michaelrhodes/hashwatch
$ cd hashwatch
$ npm install
$ npm test

License

MIT