Created
July 14, 2012 16:55
-
-
Save trunalb/3112096 to your computer and use it in GitHub Desktop.
Backbone Router
This file contains hidden or 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
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