« Back
Sammy.Application mapRoutes ( route_array )
mapRoutes takes an array of arrays, each array being passed to route()
as arguments, this allows for mass definition of routes. Another benefit is
this makes it possible/easier to load routes via remote JSON.
Example
var app = $.sammy(function() {
this.mapRoutes([
['get', '#/', function() { this.log('index'); }],
// strings in callbacks are looked up as methods on the app
['post', '#/create', 'addUser'],
// No verb assumes 'any' as the verb
[/dowhatever/, function() { this.log(this.verb, this.path)}];
]);
});
comments powered by Disqus