Last active
August 29, 2015 13:58
-
-
Save TatsuoWatanabe/10329880 to your computer and use it in GitHub Desktop.
Alloy + Typescript でModelを作成する ref: http://qiita.com/TatsuoWatanabe/items/edda7fdce6fba0c86caa
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
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; | |
}; | |
} |
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
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; | |
} | |
}; |
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
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