@nichoth/catch-routes

1.0.3 • Public • Published

catch routes

Listen for route changes and parse urls in the browser.

This is a higher level wrapper around route-event that handles url parsing as well.

install

$ npm install @nichoth/catch-routes

example

var catchRoutes = require('@nichoth/catch-routes')

var { setRoute } = catchRoutes(function onRoute (url) {
    console.log('href', url.href) //  => /some/path?foo=bar
    console.log('pathname', url.pathname) //  => /some/path
    console.log('query', url.query) //  => { foo: 'bar' }
})

// navigate programmatically
setRoute('/hello')

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.3
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.3
    1
  • 1.0.2
    0
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i @nichoth/catch-routes

Weekly Downloads

1

Version

1.0.3

License

ISC

Unpacked Size

2.27 kB

Total Files

4

Last publish

Collaborators

  • nichoth