0.0.4 • Published 10 years ago

fluxion v0.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
10 years ago

Fluxion

My personal implementation of Flux. Instead of stores I use an immutable application state object.

Setup

var Flux = require('fluxion');
var flux = Flux();

// Create application state:
// This method will replace the state object

flux.createState({
  todo: { 
    items: [], 
  }
});

// Create actions:
// This method will merge and not replace.

flux.createActions({

  change: function (data, arg1, arg2) {
    // Data is the immutable application state
  },

  add: function (data, arg1) {
    // Data is the immutable application state
  }

});

Dispatch

This is mostly used inside your component event handlers˙.

var dispatch = require('../flux').dispatch;

dispatch(['change', 'arg1', 'arg2']);

dispatch(
  ['change', 'arg1', 'arg2'],
  ['add', 'arg1'],
);

Mixin

This will bind the state of this component to a certain path of the immutable application state object.

var mixin = require('../flux').mixin;

React.createClass({

  mixins: [mixin(['todo', 'items'])],

  render: function () {
    // this.state is now equal to state.todo.items
  }

});
0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago