diff options
author | 2019-04-11 16:44:16 +0200 | |
---|---|---|
committer | 2019-04-11 16:44:16 +0200 | |
commit | eaf4aff646eed56e65c8dd8e70143ab5634ad4b4 (patch) | |
tree | ae400dca67edfd828a30da1e11d7e5e507785860 /src/features/utils/FeatureStore.js | |
parent | refactor announcements to newest feature pattern (diff) | |
download | ferdium-app-eaf4aff646eed56e65c8dd8e70143ab5634ad4b4.tar.gz ferdium-app-eaf4aff646eed56e65c8dd8e70143ab5634ad4b4.tar.zst ferdium-app-eaf4aff646eed56e65c8dd8e70143ab5634ad4b4.zip |
WIP: announcement feature and workspace fixes
Diffstat (limited to 'src/features/utils/FeatureStore.js')
-rw-r--r-- | src/features/utils/FeatureStore.js | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/features/utils/FeatureStore.js b/src/features/utils/FeatureStore.js index 66b66a104..48962561d 100644 --- a/src/features/utils/FeatureStore.js +++ b/src/features/utils/FeatureStore.js | |||
@@ -5,17 +5,38 @@ export class FeatureStore { | |||
5 | 5 | ||
6 | _reactions = null; | 6 | _reactions = null; |
7 | 7 | ||
8 | _listenToActions(actions) { | 8 | _registerActions(actions) { |
9 | if (this._actions) this._actions.forEach(a => a[0].off(a[1])); | ||
10 | this._actions = []; | 9 | this._actions = []; |
11 | actions.forEach(a => this._actions.push(a)); | 10 | actions.forEach(a => this._actions.push(a)); |
11 | this._startListeningToActions(); | ||
12 | } | ||
13 | |||
14 | _startListeningToActions() { | ||
15 | this._stopListeningToActions(); | ||
12 | this._actions.forEach(a => a[0].listen(a[1])); | 16 | this._actions.forEach(a => a[0].listen(a[1])); |
13 | } | 17 | } |
14 | 18 | ||
15 | _startReactions(reactions) { | 19 | _stopListeningToActions() { |
16 | if (this._reactions) this._reactions.forEach(r => r.stop()); | 20 | this._actions.forEach(a => a[0].off(a[1])); |
21 | } | ||
22 | |||
23 | _registerReactions(reactions) { | ||
17 | this._reactions = []; | 24 | this._reactions = []; |
18 | reactions.forEach(r => this._reactions.push(new Reaction(r))); | 25 | reactions.forEach(r => this._reactions.push(new Reaction(r))); |
26 | this._startReactions(); | ||
27 | } | ||
28 | |||
29 | _startReactions() { | ||
30 | this._stopReactions(); | ||
19 | this._reactions.forEach(r => r.start()); | 31 | this._reactions.forEach(r => r.start()); |
20 | } | 32 | } |
33 | |||
34 | _stopReactions() { | ||
35 | this._reactions.forEach(r => r.stop()); | ||
36 | } | ||
37 | |||
38 | stop() { | ||
39 | this._stopListeningToActions(); | ||
40 | this._stopReactions(); | ||
41 | } | ||
21 | } | 42 | } |