Skip to content

Instantly share code, notes, and snippets.

@danielgrippi
Created August 15, 2012 23:11
Show Gist options
  • Save danielgrippi/3364562 to your computer and use it in GitHub Desktop.
Save danielgrippi/3364562 to your computer and use it in GitHub Desktop.
top-level value initialization with backbonejs
app.pages.GenericCanvas = app.pages.Base.extend({
initialize : function(opts){
if(opts)
/* use `this` as the destination object, so values
can be overridden and defaults can be supplied */
_.extend(this, {
pageTitle: opts.title,
pageDescription: opts.description,
// more `_value_:` stuff goes here
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment