-
-
Save mxriverlynn/1731648 to your computer and use it in GitHub Desktop.
stages of backbone app startup
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
App = { | |
init: function(){ | |
// app initialization and startup goes here | |
} | |
} | |
App.init(); |
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
Backbone.Router.extend({ | |
routes: { | |
"image/:id": "imageById" | |
}, | |
imageById: function(id){ | |
var image = imageCollection.get(id); | |
App.showImage(image); | |
} | |
}); |
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
Backbone.Router.extend({ | |
routes: { | |
":roomname": "chatroom" | |
}, | |
chatroom: function(roomname){ | |
ChatApp.enterRoom(roomname); | |
} | |
}); |
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
App = new Backbone.Marionette.Application(); | |
App.addInitializer(function(){ | |
// add some app initialization code, here | |
}); | |
App.addInitializer(function(){ | |
// more initialization stuff | |
// for a different part of the app | |
}); | |
// run all the initializers and start the app | |
App.start(); |
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
App = new Backbone.Marionette.Application(); | |
/* ... initializers go here ... */ | |
// contextual startup | |
App.on("initialize:after", function(){ | |
Backbone.history.start(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment