aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/lib/Reaction.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/stores/lib/Reaction.ts')
-rw-r--r--src/stores/lib/Reaction.ts14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/stores/lib/Reaction.ts b/src/stores/lib/Reaction.ts
index 0ca24a6fa..3966c8073 100644
--- a/src/stores/lib/Reaction.ts
+++ b/src/stores/lib/Reaction.ts
@@ -1,24 +1,24 @@
1import { autorun } from 'mobx'; 1import { autorun, IReactionDisposer, IReactionPublic } from 'mobx';
2 2
3export default class Reaction { 3export default class Reaction {
4 reaction; 4 public reaction: (r: IReactionPublic) => any;
5 5
6 isRunning = false; 6 private isRunning: boolean = false;
7 7
8 dispose; 8 public dispose?: IReactionDisposer;
9 9
10 constructor(reaction) { 10 constructor(reaction: any) {
11 this.reaction = reaction; 11 this.reaction = reaction;
12 } 12 }
13 13
14 start() { 14 start(): void {
15 if (!this.isRunning) { 15 if (!this.isRunning) {
16 this.dispose = autorun(this.reaction); 16 this.dispose = autorun(this.reaction);
17 this.isRunning = true; 17 this.isRunning = true;
18 } 18 }
19 } 19 }
20 20
21 stop() { 21 stop(): void {
22 if (this.isRunning) { 22 if (this.isRunning) {
23 this.dispose?.(); 23 this.dispose?.();
24 this.isRunning = false; 24 this.isRunning = false;