1.2.15 • Published 3 years ago
@cloudflare/util-route-handler v1.2.15
cf-util-route-handler
Cloudflare Route Handler Util
Installation
$ npm install cf-util-route-handler
Usage
import {handleRoutes, routeTo} from 'cf-util-route-handler';
import Backbone from 'backbone';
// setup the router
handleRoutes(function(url) {
Backbone.history.navigate(url, true);
});
// do all the world to make the router work normally
new Backbone.Router({
routes: {
'' : () => console.log('/'),
hello : () => console.log('/hello'),
world : () => console.log('/world')
}
});
Backbone.history.start();
// start routing
routeTo('/');
routeTo('/hello');
routeTo('/world');
A handler looks like this:
handleRoutes(url => {
takeActionWithUrl(url);
});
Only one handler is allowed to be setup.
routeTo
is fire and forget, there's no callback for async transitions, and
it does not return anything.
1.2.15
3 years ago
1.2.13
3 years ago
1.2.14
3 years ago
1.2.12
3 years ago
1.2.11
4 years ago
1.2.8
4 years ago
1.2.9
4 years ago
1.2.7
4 years ago
1.2.5
4 years ago
1.2.4
4 years ago
1.2.3
5 years ago
1.2.2
5 years ago
1.2.1
5 years ago
1.2.0
6 years ago
1.1.1
6 years ago
1.1.0
6 years ago
1.0.13
6 years ago
1.0.12
6 years ago
1.0.11
6 years ago
1.0.10
6 years ago
1.0.9
6 years ago
1.0.8
6 years ago
1.0.7
6 years ago
1.0.6
6 years ago
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago