ZeroFrame Router

A very basic router that works with the ZeroFrame API.

Example Usage
Router.add('about', function () {
console.log('about');
}).add('tutorials', function() {
console.log('tutorials')
}).add('products/:pid/edit/:eid', function(params) {
console.log('products', params.pid, params.eid);
// If you go to route: /products/21/edit/3
// It will log: products 21 3
}).add('*/create', function() {
console.log('Wildcard example');
}).add(function() {
console.log('home');
});
Router.init();

To navigate to a route, use the Router.navigate('/route') function.
You must also make sure your ZeroFrame instance is called page.

Note: You must also call Router.listenForBack() in the OnRequest()
function of your ZeroFrame class. This will detect when the user hits the
back button and navigate to the correct route.

Download router.js File Github Link
This page is a snapshot of ZeroNet. Start your own ZeroNet for complete experience. Learn More