0.0.1 • Published 9 years ago

ampersand-collection-fluxible-mixin v0.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

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