Inheritance in alloy?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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