observ-location-hash

1.0.2 • Public • Published

observ-location-hash Build Status

Observable interface to the browser hash location

Install

$ npm install --save observ-location-hash

Usage

var ObservHash = require('observ-location-hash')

var hash = ObservHash('/initial-path')

hash(function (hash) {
  //=> (called on window's hashchange event)
})

hash()
//=> returns current hash, minus '#' character

hash.set(path)
//=> sets current hash

API

ObservHash([initialPath]) -> observHash

observHash([listener]) -> function

Returns an unlisten function.

listener

Type: function

A function to call with the current path when the hash changes.

observHash.set(path) -> undefined

Updates window.locaion.hash.

Related

License

MIT © Andrew Joslin

Package Sidebar

Install

npm i observ-location-hash

Weekly Downloads

0

Version

1.0.2

License

MIT

Last publish

Collaborators

  • andytjoslin