diff options
author | 2019-04-12 15:51:57 +0200 | |
---|---|---|
committer | 2019-04-12 15:52:55 +0200 | |
commit | 76bf7b840ea7d607a21b0294d10be01b26ad0607 (patch) | |
tree | 05b15350fa8cf00972ae8caab812868b9fa9dfe0 /src/features/utils/FeatureStore.js | |
parent | align announcement and spotlight (diff) | |
download | ferdium-app-76bf7b840ea7d607a21b0294d10be01b26ad0607.tar.gz ferdium-app-76bf7b840ea7d607a21b0294d10be01b26ad0607.tar.zst ferdium-app-76bf7b840ea7d607a21b0294d10be01b26ad0607.zip |
merge-in latest develop
Diffstat (limited to 'src/features/utils/FeatureStore.js')
-rw-r--r-- | src/features/utils/FeatureStore.js | 17 |
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 @@ | |||
1 | import Reaction from '../../stores/lib/Reaction'; | 1 | import { union } from 'lodash'; |
2 | 2 | ||
3 | export class FeatureStore { | 3 | export 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) { |