diff options
author | 2021-10-14 09:32:20 +0200 | |
---|---|---|
committer | 2021-10-14 13:02:20 +0530 | |
commit | 52211095aab71f8b59b093b19ae34c222be9f390 (patch) | |
tree | 28f24a9be5ee5577667cdd396fb3fc64fc861e65 /src/stores/lib/Reaction.js | |
parent | chore: convert class components to functional (#2065) (diff) | |
download | ferdium-app-52211095aab71f8b59b093b19ae34c222be9f390.tar.gz ferdium-app-52211095aab71f8b59b093b19ae34c222be9f390.tar.zst ferdium-app-52211095aab71f8b59b093b19ae34c222be9f390.zip |
chore: convert various JS to TS (#2062)
Diffstat (limited to 'src/stores/lib/Reaction.js')
-rw-r--r-- | src/stores/lib/Reaction.js | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/src/stores/lib/Reaction.js b/src/stores/lib/Reaction.js deleted file mode 100644 index 7e1bc685e..000000000 --- a/src/stores/lib/Reaction.js +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | import { autorun } from 'mobx'; | ||
2 | |||
3 | export default class Reaction { | ||
4 | reaction; | ||
5 | |||
6 | isRunning = false; | ||
7 | |||
8 | dispose; | ||
9 | |||
10 | constructor(reaction) { | ||
11 | this.reaction = reaction; | ||
12 | } | ||
13 | |||
14 | start() { | ||
15 | if (!this.isRunning) { | ||
16 | this.dispose = autorun(this.reaction); | ||
17 | this.isRunning = true; | ||
18 | } | ||
19 | } | ||
20 | |||
21 | stop() { | ||
22 | if (this.isRunning) { | ||
23 | this.dispose(); | ||
24 | this.isRunning = false; | ||
25 | } | ||
26 | } | ||
27 | } | ||
28 | |||
29 | export const createReactions = (reactions) => ( | ||
30 | reactions.map((r) => new Reaction(r)) | ||
31 | ); | ||