aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/utils/FeatureStore.ts
diff options
context:
space:
mode:
authorLibravatar muhamedsalih-tw <104364298+muhamedsalih-tw@users.noreply.github.com>2022-11-20 17:35:21 +0530
committerLibravatar GitHub <noreply@github.com>2022-11-20 17:35:21 +0530
commit86f9ab693dcad951271f727046214b03d91ebd69 (patch)
tree3d32ff4814b5484495b811c5fe0ebea4805f4e55 /src/features/utils/FeatureStore.ts
parent6.2.1-nightly.47 [skip ci] (diff)
downloadferdium-app-86f9ab693dcad951271f727046214b03d91ebd69.tar.gz
ferdium-app-86f9ab693dcad951271f727046214b03d91ebd69.tar.zst
ferdium-app-86f9ab693dcad951271f727046214b03d91ebd69.zip
Transform Todo feature, ServiceBarTargetUrl, ServiceIcon, TeamDashboard, Slider, Loader & WorkspaceSwitchningIndicator into ts (#782)
Diffstat (limited to 'src/features/utils/FeatureStore.ts')
-rw-r--r--src/features/utils/FeatureStore.ts48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/features/utils/FeatureStore.ts b/src/features/utils/FeatureStore.ts
new file mode 100644
index 000000000..2bdd167f3
--- /dev/null
+++ b/src/features/utils/FeatureStore.ts
@@ -0,0 +1,48 @@
1import Reaction from '../../stores/lib/Reaction';
2
3export default class FeatureStore {
4 _actions: any = [];
5
6 _reactions: Reaction[] = [];
7
8 stop() {
9 this._stopActions();
10 this._stopReactions();
11 }
12
13 // ACTIONS
14 _registerActions(actions) {
15 this._actions = actions;
16 this._startActions();
17 }
18
19 _startActions(actions = this._actions) {
20 for (const action of actions) {
21 action.start();
22 }
23 }
24
25 _stopActions(actions = this._actions) {
26 for (const action of actions) {
27 action.stop();
28 }
29 }
30
31 // REACTIONS
32 _registerReactions(reactions) {
33 this._reactions = reactions;
34 this._startReactions();
35 }
36
37 _startReactions(reactions = this._reactions) {
38 for (const reaction of reactions) {
39 reaction.start();
40 }
41 }
42
43 _stopReactions(reactions = this._reactions) {
44 for (const reaction of reactions) {
45 reaction.stop();
46 }
47 }
48}