UNPKG

shifty-router

Version:

Fast, modular client router, based on sheet-router

15 lines (12 loc) 359 B
var window = require('global/window') var assert = require('assert') module.exports = hash // listen to window hashchange events // and update router accordingly // fn(cb) -> null function hash (cb) { assert.equal(typeof cb, 'function', 'sheet-router/hash: cb must be a function') window.onhashchange = function (e) { cb(window.location.hash) } }