Skip to content

Instantly share code, notes, and snippets.

@shinokada
Created January 7, 2013 02:59
Show Gist options
  • Save shinokada/4471959 to your computer and use it in GitHub Desktop.
Save shinokada/4471959 to your computer and use it in GitHub Desktop.
Developing backbone.js applications page 29
/*Doesn't check for existence of myApplication*/
var myApplication = {};
/*
Does check for existence. If already defined, we use that instance.
Option 1: if(!myApplication) myApplication = {};
Option 2: var myApplication = myApplication || {};
We can then populate our object literal to support models, views and collections (or any data, really):
*/
var myApplication = {
models : {},
views : {
pages : {}
},
collections : {}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment