Comparing version 6.0.2 to 6.0.3
// const debug = require('debug')('barracks') | ||
const isFsa = require('flux-standard-action').isFSA | ||
const series = require('run-series') | ||
@@ -33,2 +34,6 @@ const assert = require('assert') | ||
function emit (action, data) { | ||
if (isFsa(action)) { | ||
data = action | ||
action = action.type | ||
} | ||
assert.ok(Array.isArray(actions[action]), 'action exists') | ||
@@ -35,0 +40,0 @@ const fn = actions[action][0] |
{ | ||
"name": "barracks", | ||
"version": "6.0.2", | ||
"version": "6.0.3", | ||
"description": "Action dispatcher for unidirectional data flows", | ||
@@ -13,8 +13,8 @@ "main": "index.js", | ||
"keywords": [ | ||
"action", | ||
"dispatcher", | ||
"emitter", | ||
"event", | ||
"flux", | ||
"action", | ||
"minimal", | ||
"emitter", | ||
"event", | ||
"react", | ||
@@ -33,9 +33,10 @@ "react-component" | ||
"debug": "^2.0.0", | ||
"flux-standard-action": "^0.6.0", | ||
"run-series": "^1.1.2" | ||
}, | ||
"files": [ | ||
"LICENSE", | ||
"README.md", | ||
"LICENSE", | ||
"index.js" | ||
] | ||
} |
@@ -45,5 +45,7 @@ # barracks | ||
### dispatcher(event[, data]) | ||
### dispatcher(action[, data]) | ||
Call an action and execute the corresponding callback. Alias: | ||
`dispatcher.emit(event[, data])`. | ||
`dispatcher.emit(action[, data])`. Supports strings and | ||
[flux-standard-action](https://github.com/acdlite/flux-standard-action)s | ||
([example](https://github.com/yoshuawuyts/barracks/blob/master/examples/flux-standard-action.js)). | ||
@@ -72,12 +74,18 @@ ## Events | ||
### I want to use barracks, but I'm not sure where to start | ||
That's fine, that means this readme needs to be improved. Would you mind | ||
That's fine, but it also means this readme needs to be improved. Would you mind | ||
opening an [issue](https://github.com/yoshuawuyts/barracks/issues) and explain | ||
what you don't understand? I want `barracks` to be comprehensive for developers | ||
of any skill level, so don't hesitate to ask questions if you're unsure about | ||
something. | ||
what you're having difficulty with? I want `barracks` to be comprehensive for | ||
developers of any skill level, so don't hesitate to ask questions if you're | ||
unsure about something. | ||
### Can I use flux standard actions with barracks? | ||
[Yes you can](https://github.com/yoshuawuyts/barracks/blob/master/examples/flux-standard-action.js) | ||
use [flux standard action](https://github.com/acdlite/flux-standard-action)s | ||
with `barracks`. Just pass in an FSA compliant object into barracks, and it | ||
will be parsed correctly. | ||
### Why didn't you include feature X? | ||
An action dispatcher doesn't a lot of features to pass a message from A to B. | ||
`barracks` was built for flexibility. If you feel you're repeating yourself a | ||
lot with `barracks` or are missing a feature, feel free to wrap and extend it | ||
An action dispatcher doesn't need a lot of features to pass a message from A to | ||
B. `barracks` was built for flexibility. If you feel you're repeating yourself | ||
a lot with `barracks` or are missing a feature, feel free to wrap and extend it | ||
however you like. | ||
@@ -92,3 +100,4 @@ | ||
## See Also | ||
- [wayfarer](https://github.com/yoshuawuyts/wayfarer) - composable trie based route | ||
- [flux-standard-action](https://github.com/acdlite/flux-standard-action/) | ||
- [create-fsa](https://github.com/yoshuawuyts/create-fsa/) | ||
@@ -95,0 +104,0 @@ ## License |
9484
88
115
3
+ Addedflux-standard-action@^0.6.0
+ Addedflux-standard-action@0.6.1(transitive)
+ Addedlodash._basefor@3.0.3(transitive)
+ Addedlodash.isarguments@3.1.0(transitive)
+ Addedlodash.isarray@3.0.4(transitive)
+ Addedlodash.isplainobject@3.2.0(transitive)
+ Addedlodash.keysin@3.0.8(transitive)