Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lambdabaa/simplerouter
Yet another client-side js router!
https://github.com/lambdabaa/simplerouter
Last synced: 7 days ago
JSON representation
Yet another client-side js router!
- Host: GitHub
- URL: https://github.com/lambdabaa/simplerouter
- Owner: lambdabaa
- Created: 2015-03-22T19:35:17.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-05-25T21:31:48.000Z (over 9 years ago)
- Last Synced: 2024-04-23T22:55:30.599Z (9 months ago)
- Language: JavaScript
- Size: 172 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
simplerouter
============Yet another client-side js router!
### Usage
```js
var router = new Router({
anchorElement: document.getElementById('anchor'),
defaultState: { color: 'green' }
});router.route = state => state.color;
/**
* @return {Promise} promise that accepts with created view.
*/
router.initView = viewName => {
var element = document.createElement('div');
// ... initialize element
return element;
};router.start().then(() => {
router.setState({ color: 'yellow' }); // Go to yellow page.
});```