Skip to content

Instantly share code, notes, and snippets.

@vseventer
Created August 4, 2012 16:01
Show Gist options
  • Select an option

  • Save vseventer/3258533 to your computer and use it in GitHub Desktop.

Select an option

Save vseventer/3258533 to your computer and use it in GitHub Desktop.
Setting the store for a custom collection.
// "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