Skip to content

Instantly share code, notes, and snippets.

@thomsbg
Last active December 22, 2015 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomsbg/6526782 to your computer and use it in GitHub Desktop.
Save thomsbg/6526782 to your computer and use it in GitHub Desktop.
App initialization with namespaces
// main.js
App = {
// Namespaces
Collections: {},
Models: {},
Views: {},
Mixins: {},
initialize: function() {
this.comments = new App.Collections.Comments({ model: App.Models.Comment });
}
};
// collections/comments.js
App.Collections.Comments = Backbone.Collection.extend({});
// models/comment.js
App.Models.Comment = Backbone.Model.extend({});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment