0.3.6 • Published 9 years ago

motion-router v0.3.6

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

MotionRouter

A simple client-side router with support for old browsers (Inspired on AngularJS Router and Laravel Router).

Note: The router use hash.

Installation

  • Using bower:

    $ bower install motion-router
  • Using npm:

    $ npm install motion-router

Usage

// New router instance
var router = new MotionRouter();

// Routes
router
  .when('/', function() {
    console.log('Home');
  })
  .when('/one', callback);

// Prefix for routes
router.prefix('/group')
  .when('/one', callback) // #/group/one
  .when('/two', callback); // #/group/two

// Not registered route
router
  .otherwise(function() {
    router.redirect('/'); // Redirection to home
  });

// Run =D
router.run();

Run example

$ npm run example
0.3.6

9 years ago

0.3.5

9 years ago

0.3.4

10 years ago

0.3.3

10 years ago

0.3.2

10 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago