0.1.1 • Published 10 years ago

famous-router v0.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

famous-router

A simple hash-based router for Famo.us

Getting started

Install using bower or npm

  bower install famous-router
  npm install famous-router

Usage

Options

Router = require('famous-router');
var router = new Router({
  routes: {
     id: /some/url/with/:paramA/:paramB
  },
  force: true, // force homepage on initialization, optional
  home: 'id' // homepage, optional
});

Public API:

router.set(href,opts); // where 'opts' can be {silent:true,location:true}
router.back() 
router.add(route,id)  // add new route

Event output (emitted):

router.on('change',function({ location, params, id }); // where params is {paramA: value} if location is /ex/:paramA

Engine.on('route:xxx',function({ ...})); // where 'xxx' is an route.id

Event input (triggers):

router.trigger('home') // goto homepage

Contribute

Feel free to contribute to this project in any way. The easiest way to support this project is by giving it a star.

Contact

© 2014 - Mark Marijnissen

0.1.1

10 years ago

0.1.0

10 years ago