flux-dispatcher
A Flux dispatcher ready for action.
Install
$ npm install flux-dispatcher
Note: Your project should have it's own flux
dependency installed. We depend
on flux
via peerDependencies
.
Usage
var myDispatcher = ; // that's us, such metavar Constants = ;var ApiUtil = ; var VIEW_ACTION = ConstantsPayloadSourcesVIEW_ACTION;var SERVER_ACTION = ConstantsPayloadSourcesSERVER_ACTION;var ActionTypes = ConstantsActionTypes;var dispatch = myDispatcherhandleAction; var Actions = { ; var request = method: 'POST' url: '/api/endpoint' data: data ; ; }; moduleexports = Actions;
API
handleAction(source, type, data)
This builds a payload and dispatches it. The payload will look like this:
source: source action: type: type data: data
handleAction(type, data)
If you don't pass a source
argument, the payload will look like this:
action: type: type data: data
License
MIT
Don't forget
What you create with flux-dispatcher
is more important than flux-dispatcher
.