Created
October 5, 2013 13:39
-
-
Save gurdotan/6841071 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Define a router for the games sub-application | |
var GamesRouter = Backbone.Router.extend({ | |
routes: { | |
"": "root", | |
"games": "index", | |
"games/:id": "showGame" | |
}, | |
root : function() { /*...*/ }, | |
index : function() { /*...*/ }, | |
showGame : function(id) { /*...*/ } | |
} | |
// Define a router for the storefronts sub-application | |
var StorefrontsRouter = Backbone.Router.extend({ | |
routes: { | |
"games/:gameId/storefronts": "showStorefronts" | |
}, | |
showStorefronts : function(gameId, storefrontId) { /*...*/ }, | |
} | |
// Instantiated an instace of each router | |
// You can choose to keep references to your routers if necessary | |
new GamesRouter(); | |
new StorefrontsRouter(); | |
// Finally start Backbone's global history object | |
Backbone.history.start(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment