0.7.13 • Published 6 years ago

fluxex v0.7.13

Weekly downloads
5
License
-
Repository
github
Last release
6 years ago

FluxEx

An extended Flux implementation to build isomorphic javascript React app.

npm version npm download Dependency Status devDependency Status Build Status Test Coverage Code Climate License

npm

Features

All in one Starter

Everything in React

Minimal context APIs

To understand Flux, you only need to learn these APIs: this.executeAction(), this.getStore(), this.dispatch() !

  • this.executeAction() or this.getStore(name) in components.
  • this.dispatch() or this.executeAction() or this.getStore(name) in actions.
  • this.emitChange() or this._get() or this._set() in stores.
  • CORE Super lightweight, less than 250 lines of code.
  • CORE Context based flux system.
  • CORE React Server side rendering + client mount.
  • CORE HTML as top level react component, no need container.
  • EXTRA express middleware to serve the fluxex application.
  • EXTRA full integrated gulp task for development.
  • EXTRA pjax support.
  • EXTRA rpc and api call support.

See the FluxEx Magic

  • Check example projects you can see how fluxex do server side rendering + context deliver + Full HTML react rendering!
  • No more index.html. Start with npm:express and your Html.jsx!
  • No more AJAX, all http request by npm:request!

Start from Scratch

Read Start from Scratch to know how to create a fluxex application!

Quick Start

Prepare your project

npm init
npm install fluxex

Use the Starter template

node_modules/.bin/fluxex_starter

Start the Server

node_modules/.bin/gulp develop
  • Connect to http://localhost:3001/search?q=pizza
  • You can start your development now, gulp handled everything (jshint, browserify, nodemon, restart, browser-sync).
  • Put your actions, stores and components into correspond directories.
  • Edit components/Html.jsx to include your React components.
  • Edit actions/routing.js to add routing.
  • Edit fluxexapp.js to add your store.

Difference with Flux

FluxEx is context based flux implemention. Server side react rendering can be done easy when the flux is scoped under a request based context. Store and dispatcher are singletons in Facebook flux, but in fluxex they are not.

var myApp = require('fluxex').createApp({
    product: require('./stores/product')
}, process.cwd() + '/components/Html.jsx');
// inside a component, requires Fluxex.mixin
...
onStoreChange: function () {
    return this.getStore('myStore').getSomething();
},
handleClick: function () {
    this.executeAction(myAction);
}
// myAction
var myAction = function (payload) {
    ... do your tasks ....
    return this.dispatch('UPDATE_SOMETHING', ....); // this returns a promise
}
var myStore = {
    // the dispatch will happened after these stores be dispatched
    waitFor: {
        UPDATE_SOMETHING: ['oneStore', 'anotherStore']
    },

    // handle this.dispatch('UPDATE_SOMETHING', ....)
    handle_UPDATE_SOMETHING: function (payload) {
        this._set('data', payload); // There are ._get() and ._set() in all stores
        this.emitChange();
    }
}

Notes for IE8 support

  • NOTE React v15+ stop supporting IE8
  • You should add require('fluxex/extra/polyfill-ie8'); in your fluxexapp.js to polyfill EventListener methods and XMLHttpRequest consts for IE8.
  • catch is reserved keyword in IE8, you need to replace somePromise.catch(...) with somePromise['catch'](...)
  • for (... in ...) will loop beyond properties in IE8, you need to replace for (I in myArray) with myArray.forEach(function (V, I) { ...}

IE8 Unsupported features

  • window.history.pushState
  • set innerHTML of script or title node
  • compare prototype.constructor with another function
  • console and console.log when developer tool not opened
0.7.13

6 years ago

0.7.12

6 years ago

0.7.11

7 years ago

0.7.10

8 years ago

0.7.9

8 years ago

0.7.8

8 years ago

0.7.7

8 years ago

0.7.6

8 years ago

0.7.5

8 years ago

0.7.4

8 years ago

0.7.3

8 years ago

0.7.2

8 years ago

0.7.1

8 years ago

0.7.1-10

8 years ago

0.7.1-9

8 years ago

0.7.1-8

8 years ago

0.7.1-7

8 years ago

0.7.1-6

8 years ago

0.7.1-5

8 years ago

0.7.0

8 years ago

0.6.1-1

9 years ago

0.6.0

9 years ago

0.6.1-0

9 years ago

0.5.4-5

9 years ago

0.5.4-4

9 years ago

0.5.4-3

9 years ago

0.5.4-2

9 years ago

0.5.4-1

9 years ago

0.5.4-0

9 years ago

0.5.3

9 years ago

0.5.3-12

9 years ago

0.5.3-11

9 years ago

0.5.3-10

9 years ago

0.5.3-9

9 years ago

0.5.3-8

9 years ago

0.5.3-7

9 years ago

0.5.3-6

9 years ago

0.5.3-5

9 years ago

0.5.3-4

9 years ago

0.5.3-3

9 years ago

0.5.3-2

9 years ago

0.5.3-1

9 years ago

0.5.3-0

9 years ago

0.5.2

9 years ago

0.5.2-13

9 years ago

0.5.2-12

9 years ago

0.5.2-11

9 years ago

0.5.2-10

9 years ago

0.5.2-9

9 years ago

0.5.2-8

9 years ago

0.5.2-7

9 years ago

0.5.2-6

9 years ago

0.5.2-5

9 years ago

0.5.2-4

9 years ago

0.5.2-3

9 years ago

0.5.2-2

9 years ago

0.5.2-1

9 years ago

0.5.2-0

9 years ago

0.5.1

9 years ago

0.5.1-1

9 years ago

0.5.1-0

9 years ago

0.5.0

9 years ago

0.4.1-3

9 years ago

0.4.1-2

9 years ago

0.4.1-1

9 years ago

0.4.1-0

9 years ago

0.4.0

9 years ago

0.3.1-13

9 years ago

0.3.1-12

9 years ago

0.3.1-11

9 years ago

0.3.1-10

9 years ago

0.3.1-9

9 years ago

0.3.1-8

9 years ago

0.3.1-7

9 years ago

0.3.1-6

9 years ago

0.3.1-5

9 years ago

0.3.1-4

9 years ago

0.3.1-3

9 years ago

0.3.1-2

9 years ago

0.3.1-1

9 years ago

0.3.1-0

9 years ago

0.3.0

9 years ago

0.2.1-0

9 years ago

0.2.0

9 years ago

0.1.12-0

9 years ago

0.1.11

9 years ago

0.1.11-14

9 years ago

0.1.11-13

9 years ago

0.1.11-12

9 years ago

0.1.11-11

9 years ago

0.1.11-10

9 years ago

0.1.11-9

9 years ago

0.1.11-8

9 years ago

0.1.11-7

9 years ago

0.1.11-6

9 years ago

0.1.11-5

9 years ago

0.1.11-4

9 years ago

0.1.11-3

9 years ago

0.1.11-2

9 years ago

0.1.11-1

9 years ago

0.1.11-0

9 years ago

0.1.10

9 years ago

0.1.10-8

9 years ago

0.1.10-7

9 years ago

0.1.10-6

9 years ago

0.1.10-5

9 years ago

0.1.10-4

9 years ago

0.1.10-3

9 years ago

0.1.10-2

9 years ago

0.1.10-1

9 years ago

0.1.10-0

9 years ago

0.1.9

9 years ago

0.1.9-0

9 years ago

0.1.8-0

9 years ago

0.1.6-2

9 years ago

0.1.6-1

9 years ago

0.1.6-0

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago