1.0.1 • Published 10 years ago

routeur v1.0.1

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

routeur

Build Status Dependency Status GitHub version License

Super tiny clientside static url router

npm i routeur

Usage

import Router from 'routeur';

import indexAction from './indexAction';
import pageAction from './pageAction';

const routes = {
  '/': indexAction,
  '/page/': [() => {console.log('/page/')}, pageAction],
  '/page2/index.html': [() => {console.log('/page2/index.html')}, pageAction],
  '/page.html': [() => {console.log('/page.html')}, pageAction],
  ['/page2.html']() {
    console.log('/page2.html');
  }
};

const router = new Router(routes);

router.run();

API

.configure(config)

.run(pathname = location.pathname)

.addRoute(pathname[or route object], action)

.removeRoute(pathname)

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

© sugarshin

1.0.1

10 years ago

1.0.0

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.0

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago