Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/domchristie/backbone-modelling
Introduces a convention that all Backbone Model(ling)s have a store() as a class property. Backbone Modelling instances automatically add themselves to the store on instantiation.
https://github.com/domchristie/backbone-modelling
Last synced: 12 days ago
JSON representation
Introduces a convention that all Backbone Model(ling)s have a store() as a class property. Backbone Modelling instances automatically add themselves to the store on instantiation.
- Host: GitHub
- URL: https://github.com/domchristie/backbone-modelling
- Owner: domchristie
- Created: 2012-09-01T15:25:24.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2012-09-09T16:35:49.000Z (about 12 years ago)
- Last Synced: 2023-04-09T21:37:14.241Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 156 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Backbone Modelling
==================Introduces a convention that all Backbone Model(ling)s have a `store()` as a class property. Backbone Modelling instances automatically add themselves to the store on instantiation.
Usage
-----Instantiate the store collection as a class property. The store function should return an instance of Backbone.Collection like so:
Post = Backbone.Modelling.extend({
// prototype properties
}, {
store: function() {
return this._store = this._store ||
new Backbone.Collection();
}
});
// (Note how the store is memoized.)
Create some instances:
var post = new Post();Access the store:
Post.store().first() === post; // true
Licence
-------
Backbone Modelling is copyright © 2012 [Dom Christie](http://domchristie.co.uk) and released under the MIT license.