New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

hirouter

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hirouter

HTML5 history and router, simple, powerful and no framework.

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

HiRouter

HTML5 history and router, simple, powerful and no framework.

NPM version Build Status

It is a implementation of route-trie

Demo

var HiRouter = require('hirouter');
var router = new HiRouter();

// define router handler:
router
  .when('/projects/:id', function(state) {
    // body...
    console.log(state)
    // {
    //   fragment: '/projects/xxxxxxxId?debug=true',
    //   pathName: '/projects/xxxxxxxId',
    //   search: '?debug=true',
    //   params: {
    //     id: 'xxxxxxxId'
    //   }
    // }
  })
  .when('/organizations/:id', function(state) {
    // body...
    console.log(state)
  })
  .otherwise(function(state) {
    // body...
  })
// start listen
router.start();

// navigate to a url
router.navigate('/organizations/xxxId')

// navigate to a url and don't trigger route handler
router.navigate('/organizations/xxxId', {trigger: false})

API

new HiRouter(rootPath, options)

HiRouter.prototype.when(pattern, handler)

HiRouter.prototype.otherwise(handler)

HiRouter.prototype.navigate(fragment, options)

HiRouter.prototype.start(options)

HiRouter.prototype.route(fragment)

HiRouter.prototype.parsePath(fragment)

Object: HiRouter.prototype.history

Keywords

router

FAQs

Package last updated on 03 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts