/ampersand-state-fluxible-mixin

Use Ampersand.js states and models as Fluxible stores

Primary LanguageJavaScript

Ampersand State 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 model with the mixin and set the storeName for Fluxible:

// MyModel.js

var Model = require("ampersand-model");
var mixin = require("ampersand-model-fluxible-mixin");

var MyModel = Model.extend(mixin, {
  props: {
    that: "string"
  }
});

MyModel.storeName = "MyModel";

module.exports = MyModel;

Then, register your model with Fluxible:

// app.js

var Fluxible = require("fluxible");
var MyModel = require("./MyModel");

var app = new Fluxible({ /* options... */ });

app.registerStore(MyModel);

module.exports = app;

You may then use Fluxible according to the API.

License

MIT