diff options
author | Stefan Malzner <stefan@adlk.io> | 2019-04-12 13:32:19 +0200 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2019-04-12 13:32:19 +0200 |
commit | f941074dd7520efb63e9507294df8c420715b9df (patch) | |
tree | 614d03296254f02fe93a67a5c3b2feef1446e3aa /src/features/utils | |
parent | Don't invalidate user request on componentWillMount (diff) | |
parent | feat(App): Update electron to 4.1.4 (diff) | |
download | ferdium-app-f941074dd7520efb63e9507294df8c420715b9df.tar.gz ferdium-app-f941074dd7520efb63e9507294df8c420715b9df.tar.zst ferdium-app-f941074dd7520efb63e9507294df8c420715b9df.zip |
Merge branch 'develop' into chore/streamline-dashboard
Diffstat (limited to 'src/features/utils')
-rw-r--r-- | src/features/utils/FeatureStore.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/features/utils/FeatureStore.js b/src/features/utils/FeatureStore.js new file mode 100644 index 000000000..66b66a104 --- /dev/null +++ b/src/features/utils/FeatureStore.js | |||
@@ -0,0 +1,21 @@ | |||
1 | import Reaction from '../../stores/lib/Reaction'; | ||
2 | |||
3 | export class FeatureStore { | ||
4 | _actions = null; | ||
5 | |||
6 | _reactions = null; | ||
7 | |||
8 | _listenToActions(actions) { | ||
9 | if (this._actions) this._actions.forEach(a => a[0].off(a[1])); | ||
10 | this._actions = []; | ||
11 | actions.forEach(a => this._actions.push(a)); | ||
12 | this._actions.forEach(a => a[0].listen(a[1])); | ||
13 | } | ||
14 | |||
15 | _startReactions(reactions) { | ||
16 | if (this._reactions) this._reactions.forEach(r => r.stop()); | ||
17 | this._reactions = []; | ||
18 | reactions.forEach(r => this._reactions.push(new Reaction(r))); | ||
19 | this._reactions.forEach(r => r.start()); | ||
20 | } | ||
21 | } | ||