Skip to content

Instantly share code, notes, and snippets.

@TatsuoWatanabe
Last active August 29, 2015 13:58
Show Gist options
  • Save TatsuoWatanabe/10329880 to your computer and use it in GitHub Desktop.
Save TatsuoWatanabe/10329880 to your computer and use it in GitHub Desktop.
Alloy + Typescript でModelを作成する ref: http://qiita.com/TatsuoWatanabe/items/edda7fdce6fba0c86caa
interface IExportableModel {
config: {
columns: any;
adapter: {
type: any;
collection_name: any
}
};
exportsDefinition: {
config: typeof config;
extendModel: (Model: Backbone.Model) => Backbone.Model;
extendCollection: (Collection: Backbone.Collection) => Backbone.Collection;
};
}
exports.definition = {
config: {
columns: {
"task": "text",
"limitTime": "text",
"done": "integer"
},
adapter: {
type: "sql",
collection_name: "Todo"
}
},
extendModel: function (Model) {
_.extend(Model.prototype, {
// extended functions and properties go here
});
return Model;
},
extendCollection: function (Collection) {
_.extend(Collection.prototype, {
// extended functions and properties go here
});
return Collection;
}
};
extendModel: function(Model: Backbone.Model) {
_.extend(Model.prototype, Todo.prototype);
return Model;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment