ampersand-sync-adapter

0.0.1 • Public • Published

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

Package Sidebar

Install

npm i ampersand-sync-adapter

Weekly Downloads

5

Version

0.0.1

License

MIT

Last publish

Collaborators

  • fractal
  • yocontra