Created
June 15, 2013 05:20
-
-
Save shohey1226/5787007 to your computer and use it in GitHub Desktop.
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.routers.AppRouter = Backbone.Router.extend({ | |
routes: { | |
"": "home", | |
"employees/:id": "employeeDetails", | |
"employees/:id/reports": "reports", | |
"employees/:id/map": "map" | |
}, | |
initialize: function () { | |
app.slider = new PageSlider($('body')); | |
}, | |
home: function () { | |
// Since the home view never changes, we instantiate it and render it only once | |
if (!app.homeView) { | |
app.homeView = new app.views.HomeView(); | |
app.homeView.render(); | |
} else { | |
console.log('reusing home view'); | |
app.homeView.delegateEvents(); // delegate events when the view is recycled | |
} | |
app.slider.slidePage(app.homeView.$el); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment