1.0.2 • Published 10 years ago
observ-path v1.0.2
observ-path 
Observable interface to the browser path with history support
Install
$ npm install --save observ-pathUsage
var Path = require('observ-path')
var path = Path('/the/initial/path')
path(console.log)
//=> path changed
path.set('/the/new/path')
//=> path updated and history entry addedAPI
Path([value]) -> function
Returns an observable path.
value
Type: string
Default: ''
The initial path, defaulting to document.location.pathname in the browser and '' in Node.
path([fn]) -> function / string
fn
Type: function
A function to call when the path changes. If no function is provided, the current value is returned.
path.set(value) -> undefined
value
Required
Type: string
The new path value to set.
License
MIT © Ben Drucker