Skip to content

Instantly share code, notes, and snippets.

@trunalb
Created July 14, 2012 16:55
Show Gist options
  • Save trunalb/3112096 to your computer and use it in GitHub Desktop.
Save trunalb/3112096 to your computer and use it in GitHub Desktop.
Backbone Router
App.BaseRouter = Backbone.Router.extend({
showPage : function(pageId, callback){
//perform basic pre-show checks
//implement transitions (and turn them off if required)
}
});
App.Router = App.BaseRouter.extend({
routes : {
"show" : "showData",
"showProfile" : "showProfile"
},
show : function(){
this.showPage('#page',function(){
//do your stuff
});
},
showProfile : function(){
this.showPage('#profilePage',function(){
//do your stuff
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment