Skip to content

Instantly share code, notes, and snippets.

@marvi
Created December 17, 2012 10:42
Show Gist options
  • Save marvi/4317355 to your computer and use it in GitHub Desktop.
Save marvi/4317355 to your computer and use it in GitHub Desktop.
Backbone: start
_.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