node package manager

super-tiny-hash-router

super-tiny-hash-router NPM version NPM downloads Build Status

bite-sized front-end router.

Install

$ npm install --save super-tiny-hash-router

CDN version: https://unpkd.com/super-tiny-hash-router/dist/

Usage

import createRouter from 'super-tiny-hash-router'
 
const router = createRouter()
 
router.add('/', () => {
  renderHome()
})
 
router.add('*', () => {
  render404()
})
 
// home router and 404 router are required before calling router.init() 
router.init()
 
router.go('/user/egoist')

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT © EGOIST