Created
December 17, 2012 10:42
-
-
Save marvi/4317355 to your computer and use it in GitHub Desktop.
Backbone: 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
_.templateSettings = { | |
interpolate: /\{\{=(.+?)\}\}/g, | |
evaluate: /\{\{(.+?)\}\}/g | |
}; | |
// We begin by creating a namespace `xx`. Choose the name you want. | |
var App = {}; | |
// Then the view namespace. | |
// We will put class (starting with an upper case), | |
// and instances (starting with a lower case) shared in the whole application | |
App.views = {}; | |
// Then the model namespace. | |
// A collection share the Model name but end with a `s` (the plural of the Model). | |
// For exemple: | |
// | |
// * Model: Todo | |
// * Collection: Todos | |
// | |
// Class and instances(global in the whole application) will be present under this namespace. | |
App.models = {}; | |
// Put under this namespace home made utils functions. | |
App.util = {}; | |
// Event aggregator | |
App.vent = _.extend({}, Backbone.Events); | |
$(function() { | |
App.router = new App.Router(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment