Skip to content

Instantly share code, notes, and snippets.

@aarondfrancis
Created December 18, 2012 00:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aarondfrancis/4323639 to your computer and use it in GitHub Desktop.
Save aarondfrancis/4323639 to your computer and use it in GitHub Desktop.
Inheritance in alloy?
var App = require('application');
exports.definition = {
config: {
"adapter": {
"type": "properties",
"collection_name": "someChildClass"
}
},
extendModel: function(Model) {
// IMPORTANT PART
var Parent = Alloy.createModel('someParentClass', arguments);
_.extend(Model.prototype, Parent);
// END
_.extend(Model.prototype, {
// extended functions go here
}); // end extend
return Model;
},
extendCollection: function(Collection) {
_.extend(Collection.prototype, {
// extended functions go here
}); // end extend
return Collection;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment