aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/utils/FeatureStore.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/features/utils/FeatureStore.js')
-rw-r--r--src/features/utils/FeatureStore.js17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/features/utils/FeatureStore.js b/src/features/utils/FeatureStore.js
index d863f7464..967e745b2 100644
--- a/src/features/utils/FeatureStore.js
+++ b/src/features/utils/FeatureStore.js
@@ -1,4 +1,4 @@
1import Reaction from '../../stores/lib/Reaction'; 1import { union } from 'lodash';
2 2
3export class FeatureStore { 3export class FeatureStore {
4 _actions = null; 4 _actions = null;
@@ -13,25 +13,24 @@ export class FeatureStore {
13 // ACTIONS 13 // ACTIONS
14 14
15 _registerActions(actions) { 15 _registerActions(actions) {
16 this._actions = []; 16 this._actions = union(this._actions, actions);
17 actions.forEach(a => this._actions.push(a)); 17 this._startActions();
18 this._startActions(this._actions);
19 } 18 }
20 19
21 _startActions(actions = this._actions) { 20 _startActions(actions = this._actions) {
22 actions.forEach(a => a[0].listen(a[1])); 21 console.log(actions);
22 actions.forEach(a => a.start());
23 } 23 }
24 24
25 _stopActions(actions = this._actions) { 25 _stopActions(actions = this._actions) {
26 actions.forEach(a => a[0].off(a[1])); 26 actions.forEach(a => a.stop());
27 } 27 }
28 28
29 // REACTIONS 29 // REACTIONS
30 30
31 _registerReactions(reactions) { 31 _registerReactions(reactions) {
32 this._reactions = []; 32 this._reactions = union(this._reactions, reactions);
33 reactions.forEach(r => this._reactions.push(new Reaction(r))); 33 this._startReactions();
34 this._startReactions(this._reactions);
35 } 34 }
36 35
37 _startReactions(reactions = this._reactions) { 36 _startReactions(reactions = this._reactions) {