FluentJS: A tiny Facebook Flux library (< 100 LOC)
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
.gitignore
LICENSE
README.md
index.js
package.json

README.md

FluentJS

FluentJS is a tiny Flux implementation we’re using in our site twincl.com. It has some good features:

  • Very tiny - less than 100 lines of code.
  • ES2015 class-based.
  • Can be used at server-side rendering. (For example, all twincl.com pages can be rendered at server side by appending a ?ssr=1 query parameter.)
  • Makes your code very terse. No more repetitive emitChange, add/removeChangeListener, ActionTypes constants, etc.
  • As close to Facebook Flux pattern and as few magic as possible.
  • Can be used with Facebook Flow type checker effectively. (For example, if you call an action creator or store method with wrong argument types, the Flow type checker will complain.)

If you already know Flux, a quick way to glimpse FluentJS is by looking at our fluent-chat example modified from the Facebook flux-chat code. This commit shows the code changes. As you can see, lots of repetitive code were removed.

Installation

To install FluentJS, type:

npm install --save fluent-js

Usage

See this page (English) or this page (中文).