1.0.3 • Published 9 years ago
observ-history v1.0.3
observ-history
Observable interface to the browser history API
Install
$ npm install --save observ-history
Usage
var history = require('observ-history')
history(function (path) {
//=> (popstate)
})
history()
//=> current path
history.set(path)
//=> pushState
API
history([listener])
-> function
Returns an unlisten function.
listener
Type: function
A function to call with the current path when the history changes and a popstate
event is fired. If no function is passed, the current path is returned.
history.set(path)
-> undefined
Updates the history by calling pushState
.
License
MIT © Ben Drucker