+5
-3
@@ -161,3 +161,3 @@ const mutate = require('xtend/mutable') | ||
| const reducedState = _reducers[actionName](data, _state[ns]) | ||
| mutate(newState[ns], xtend(_state[ns], reducedState)) | ||
| newState[ns] = xtend(_state[ns], reducedState) | ||
| } else { | ||
@@ -167,3 +167,5 @@ mutate(newState, reducers[actionName](data, _state)) | ||
| reducersCalled = true | ||
| if (onStateChange) onStateChange(data, newState, _state, actionName, createSend) | ||
| if (onStateChange) { | ||
| onStateChange(data, newState, _state, actionName, createSend) | ||
| } | ||
| _state = newState | ||
@@ -194,5 +196,5 @@ cb() | ||
| function apply (ns, source, target, createSend, done) { | ||
| if (ns && !target[ns]) target[ns] = {} | ||
| Object.keys(source).forEach(function (key) { | ||
| if (ns) { | ||
| if (!target[ns]) target[ns] = {} | ||
| target[ns][key] = source[key] | ||
@@ -199,0 +201,0 @@ } else { |
+1
-1
| { | ||
| "name": "barracks", | ||
| "version": "8.0.2", | ||
| "version": "8.0.3", | ||
| "description": "Action dispatcher for unidirectional data flows", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+4
-4
@@ -17,9 +17,9 @@ # barracks | ||
| console.error(`error: ${err}`) | ||
| }), | ||
| }, | ||
| onAction: (data, state, name, caller, createSend) => { | ||
| console.log(`data: ${data}`) | ||
| }) | ||
| }, | ||
| onStateChange: (data, state, prev, caller, createSend) => { | ||
| console.log(`state: ${prev} -> ${state}`) | ||
| }) | ||
| } | ||
| }) | ||
@@ -304,3 +304,3 @@ | ||
| framework | ||
| - [send-action](https://github.com/sethdvincent/send-action) - unidirectional | ||
| - [send-action](https://github.com/sethvincent/send-action) - unidirectional | ||
| action emitter | ||
@@ -307,0 +307,0 @@ |
21353
0.08%190
1.06%