Files
buuh/lib/history.js
T
Greenkeeper 1cec8bbf22 Update standard to version 10.0.0 🚀 (#468)
* chore(package): update standard to version 10.0.0

https://greenkeeper.io/

* appease the standard gods
2017-04-07 18:19:23 +02:00

20 lines
486 B
JavaScript

var assert = require('assert')
module.exports = history
// listen to html5 pushstate events
// and update router accordingly
// fn(str) -> null
function history (cb) {
assert.equal(typeof cb, 'function', 'sheet-router/history: cb must be a function')
window.onpopstate = function () {
var obj = {
pathname: document.location.pathname,
search: document.location.search,
href: document.location.href,
hash: document.location.hash
}
cb(obj)
}
}