ActionHub is a library inspired by Facebook's Flux. It aims to create flux-like actions that can be used with any framework.
src
contains the pre-build files of flux-action.js.gulp
contains the gulp task files.
Here is the overview for the files under src
folder:
action-factory.js
is the entry point of action-hub.js.disptacher.js
is a stripped-down version of facebook's dispatcher.js.action.js
represents action with both dispatch and register functionalities.
Here are the steps:
- Install
gulp
globally if you haven't done so. - Run
npm install
. - Run
gulp
to build theflux-action.js
.
var actions = actionHub.createActions({
name: ['added', 'removed'],
group: 'todo',
logger: {
log: function (data) {
console.log(data);
}
}
});
actions.added.register(function (data) {
console.log(data);
});
actions.added.dispatch('45');