0.0.16 • Published 10 years ago

fluxive v0.0.16

Weekly downloads
5
License
MIT
Repository
github
Last release
10 years ago

Fluxive

Flux-like MVB(MVVM) Library

Installation

npm install fluxive

Difference between Fluxive and Flux

Flux defines data flow as:

Action → Dispatcher → Store → View → Action → ...

But, Fluxive defines data flow as:

        (Model)
           ↓
Action → Binder → View → Action → ...

Notice:

  • Binder is Dispacher, and also Store in Flux.
  • Model is maybe unnecessary, but if you feel data store becoming more complex, you can use Model to solve its complexity.

Simple example

Create Action

let fooAction = Fluxive.Action(input => {
  let output = /* some code */;
  return output;
});

Create Binder

class FooBinder extends Fluxive.Binder {
  constructor() {
    super();
    this.state = {
      fooInfo: 'initial foo'
    };
    this.on(fooAction, output => {
      this.setState({fooInfo: output});
    });
  }
}

Create Component

class FooHandler extends Fluxive.Component {
  constructor(props) {
    super(props);
    this.involve(FooBinder);
  }
  render() {
    let {binder} = this;
    return (
      <p>Foo info: {binder.get('fooInfo')}</p>
    );
  }
}

More details

Preparing

LICENSE

MIT

0.0.17

10 years ago

0.0.16

10 years ago

0.0.15

10 years ago

0.0.14

10 years ago

0.0.13

10 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago