Created
August 4, 2012 16:01
-
-
Save vseventer/3258533 to your computer and use it in GitHub Desktop.
Setting the store for a custom collection.
This file contains hidden or 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
| // "items" is the collection name. | |
| var Item = Kinvey.Entity.extend({ | |
| constructor: function(attributes) { | |
| Kinvey.Entity.prototype.constructor.call(this, attributes, 'items', { | |
| store: 'offline', | |
| options: { policy: 'cachefirst' } | |
| }); | |
| } | |
| }); | |
| var Items = Kinvey.Collection.extend({ | |
| entity: Item, | |
| constructor: function() { | |
| Kinvey.Collection.prototype.constructor.call(this, 'items', { | |
| store: 'offline', | |
| options: { policy: 'cachefirst' } | |
| }); | |
| } | |
| }); | |
| new Items.fetch({ | |
| success: function(items) { | |
| console.log('success'); | |
| }, | |
| error: function(error) { | |
| console.log('error'); | |
| }, | |
| complete: function() { | |
| console.log('complete'); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment