ampersand-collection-rest-mixin
Part of the Ampersand.js toolkit for building clientside applications.
A mixin for extending ampersand-collection with restful methods. To make it behave much like Backbone.
install
npm install ampersand-collection-rest-mixin
example
var Collection = require('ampersand-collection');
var restMixin = require('ampersand-collection-rest-mixin');
module.exports = Collection.extend(restMixin, {
sampleMethod: function () {
// now we've got restful methods in our collection
this.sync( ... );
this.fetch( ... );
this.create( ... )
}
});
credits
All credit for this approach in backbone goes to Jeremy Ashkenas and the rest of the Backbone and Underscore authors.
license
MIT