A simple library for uni-directional dataflow application architecture inspired by ReactJS Flux
npm install reflux-corereflux-core as an npm package:
core-js/es5 from core-js or es5-shim.js from kriskowal's es5-shim.
npm install
package.json file.
npm compile Use babel to transpile the ES6 code to ES5, output is /lib.
npm test To run the jshint and tests
npm run watch To run the watch task. It will lint, compile and test the code whenever a file is saved.
npm run benchmark To run the benchmark test
reflux-coreReflux#use can handle.
javascript
// addon.js
// The callback recieves an instance of Reflux library that is being used.
export default function(Reflux) {
// add a simple function to Reflux
Reflux.createState = function() {
return {};
};
}
`
The user will have to do the following to use the add-on:
`javascript
import Reflux from "reflux-core";
// or "reflux" or any other reflux with extensions
import createStateAddon from "./addon.js";
Reflux.use(createStateAddon);
console.log(Reflux.createState());
// outputs {}
`
* When publishing the plugin to npm, you don't need to have reflux-core or reflux as a dependency among dependencies in package.json as the user provides the version they use through the Reflux#use method.
* If you're writing tests, you may want to use reflux-core and put it in devDependencies instead.
* You may name your library reflux-addon-{name}.
* Please do provide reflux-addon among keywords in package.json so that users can easily search for your addon in the npm registry.
$3
Install reflux-core as a dependency and publish it as a library to npm. Here is an example entry point:
`javascript
// index.js
import Reflux from "reflux-core";
import frameworkExtras from "./framework-extras";
Reflux.use(frameworkExtras); // like an add-on
export default Reflux; // export the amended Reflux lib
`
* You may name your library reflux-{view library}. E.g. if you're doing mixins for angular then it may be named reflux-angular.
* Please do provide reflux among keywords in package.json` so that users can easily search for your extensions in the npm registry.