aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/lib
diff options
context:
space:
mode:
authorLibravatar Ricardo Cino <ricardo@cino.io>2022-06-24 21:25:05 +0200
committerLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2022-06-25 05:50:00 +0530
commit2d71e61e46394d75d9f52ba1f4c273ed6d3c9cfd (patch)
tree7c0172945f962609637d03e7de885a254dbec8a4 /src/stores/lib
parentchore: improve todo menu behaviour on fresh install (#359) (diff)
downloadferdium-app-2d71e61e46394d75d9f52ba1f4c273ed6d3c9cfd.tar.gz
ferdium-app-2d71e61e46394d75d9f52ba1f4c273ed6d3c9cfd.tar.zst
ferdium-app-2d71e61e46394d75d9f52ba1f4c273ed6d3c9cfd.zip
chore: convert the last few stores to typescript
Diffstat (limited to 'src/stores/lib')
-rw-r--r--src/stores/lib/Store.js54
1 files changed, 0 insertions, 54 deletions
diff --git a/src/stores/lib/Store.js b/src/stores/lib/Store.js
deleted file mode 100644
index 739a47729..000000000
--- a/src/stores/lib/Store.js
+++ /dev/null
@@ -1,54 +0,0 @@
1import { computed, observable } from 'mobx';
2import Reaction from './Reaction';
3
4export default class Store {
5 /** @type Stores */
6 stores;
7
8 /** @type ApiInterface */
9 api;
10
11 /** @type Actions */
12 actions;
13
14 /** @type Reaction[] */
15 _reactions = [];
16
17 // status implementation
18 @observable _status = null;
19
20 @computed get actionStatus() {
21 return this._status || [];
22 }
23
24 set actionStatus(status) {
25 this._status = status;
26 }
27
28 constructor(stores, api, actions) {
29 this.stores = stores;
30 this.api = api;
31 this.actions = actions;
32 }
33
34 registerReactions(reactions) {
35 for (const reaction of reactions) {
36 this._reactions.push(new Reaction(reaction));
37 }
38 }
39
40 setup() {}
41
42 initialize() {
43 this.setup();
44 for (const reaction of this._reactions) reaction.start();
45 }
46
47 teardown() {
48 for (const reaction of this._reactions) reaction.stop();
49 }
50
51 resetStatus() {
52 this._status = null;
53 }
54}