ampersand-collection-fluxible-mixin

0.0.1 • Public • Published

Ampersand Collection Fluxible Mixin

This module implements the dehydrate and rehydrate methods for Ampersand.js states and models to be used as Fluxible Stores.

Install

npm install --save ampersand-model-fluxible-mixin

Usage

Define your collection with the mixin and set the storeName for Fluxible:

// MyModel.js
 
var MyModel = require("./MyModel");
var Collection = require("ampersand-collection");
var mixin = require("ampersand-collection-fluxible-mixin");
 
var MyCollection = Collection.extend(mixin, {
  model: MyModel
});
 
MyCollection.storeName = "MyCollection";
 
module.exports = MyCollection;

Then, register your model with Fluxible:

// app.js
 
var Fluxible = require("fluxible");
var MyCollection = require("./MyCollection");
 
var app = new Fluxible({ /* options... */ });
 
app.registerStore(MyCollection);
 
module.exports = app;

You may then use Fluxible according to the API.

License

MIT

Package Sidebar

Install

npm i ampersand-collection-fluxible-mixin

Weekly Downloads

0

Version

0.0.1

License

MIT

Last publish

Collaborators

  • mikepb