0.3.6 • Published 8 years ago

motion-router v0.3.6

Weekly downloads
1
License
MIT
Repository
github
Last release
8 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

8 years ago

0.3.5

8 years ago

0.3.4

8 years ago

0.3.3

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago