@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')

Dependencies (3)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @nichoth/catch-routes

    Weekly Downloads

    0

    Version

    1.0.3

    License

    ISC

    Unpacked Size

    2.27 kB

    Total Files

    4

    Last publish

    Collaborators

    • nichoth