routeur
v1.0.1
Published
Super tiny clientside static url router
Downloads
11
Maintainers
Readme
routeur
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
- Fork it!
- Create your feature branch: git checkout -b my-new-feature
- Commit your changes: git commit -am 'Add some feature'
- Push to the branch: git push origin my-new-feature
- Submit a pull request :D
License
© sugarshin