diff options
author | Dominik Guzei <dominik.guzei@gmail.com> | 2019-04-12 15:51:57 +0200 |
---|---|---|
committer | Dominik Guzei <dominik.guzei@gmail.com> | 2019-04-12 15:52:55 +0200 |
commit | 76bf7b840ea7d607a21b0294d10be01b26ad0607 (patch) | |
tree | 05b15350fa8cf00972ae8caab812868b9fa9dfe0 /src/stores/lib | |
parent | align announcement and spotlight (diff) | |
download | ferdium-app-76bf7b840ea7d607a21b0294d10be01b26ad0607.tar.gz ferdium-app-76bf7b840ea7d607a21b0294d10be01b26ad0607.tar.zst ferdium-app-76bf7b840ea7d607a21b0294d10be01b26ad0607.zip |
merge-in latest develop
Diffstat (limited to 'src/stores/lib')
-rw-r--r-- | src/stores/lib/Reaction.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/stores/lib/Reaction.js b/src/stores/lib/Reaction.js index b123ec01c..f2642908f 100644 --- a/src/stores/lib/Reaction.js +++ b/src/stores/lib/Reaction.js | |||
@@ -1,4 +1,3 @@ | |||
1 | // @flow | ||
2 | import { autorun } from 'mobx'; | 1 | import { autorun } from 'mobx'; |
3 | 2 | ||
4 | export default class Reaction { | 3 | export default class Reaction { |
@@ -15,14 +14,18 @@ export default class Reaction { | |||
15 | start() { | 14 | start() { |
16 | if (!this.isRunning) { | 15 | if (!this.isRunning) { |
17 | this.dispose = autorun(() => this.reaction()); | 16 | this.dispose = autorun(() => this.reaction()); |
18 | this.isRunning = true; | 17 | this.isActive = true; |
19 | } | 18 | } |
20 | } | 19 | } |
21 | 20 | ||
22 | stop() { | 21 | stop() { |
23 | if (this.isRunning) { | 22 | if (this.isRunning) { |
24 | this.dispose(); | 23 | this.dispose(); |
25 | this.isRunning = true; | 24 | this.isActive = false; |
26 | } | 25 | } |
27 | } | 26 | } |
28 | } | 27 | } |
28 | |||
29 | export const createReactions = reactions => ( | ||
30 | reactions.map(r => new Reaction(r)) | ||
31 | ); | ||