diff options
author | vantezzen <hello@vantezzen.io> | 2019-10-24 15:55:22 +0200 |
---|---|---|
committer | vantezzen <hello@vantezzen.io> | 2019-10-24 15:55:22 +0200 |
commit | bacb5b940333f7e3af9f9d978d1d72c75f1aa321 (patch) | |
tree | 50c8ecb3d08e997106e48d1de5b904a2dba30991 /src/features/planSelection/index.js | |
parent | Merge translations (diff) | |
parent | Switch to beta version (diff) | |
download | ferdium-app-bacb5b940333f7e3af9f9d978d1d72c75f1aa321.tar.gz ferdium-app-bacb5b940333f7e3af9f9d978d1d72c75f1aa321.tar.zst ferdium-app-bacb5b940333f7e3af9f9d978d1d72c75f1aa321.zip |
Merge branch 'develop' into l10n_develop
Diffstat (limited to 'src/features/planSelection/index.js')
-rw-r--r-- | src/features/planSelection/index.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/features/planSelection/index.js b/src/features/planSelection/index.js new file mode 100644 index 000000000..890be8871 --- /dev/null +++ b/src/features/planSelection/index.js | |||
@@ -0,0 +1,28 @@ | |||
1 | import { reaction } from 'mobx'; | ||
2 | import PlanSelectionStore from './store'; | ||
3 | |||
4 | const debug = require('debug')('Franz:feature:planSelection'); | ||
5 | |||
6 | export const planSelectionStore = new PlanSelectionStore(); | ||
7 | |||
8 | export default function initPlanSelection(stores, actions) { | ||
9 | stores.planSelection = planSelectionStore; | ||
10 | const { features } = stores; | ||
11 | |||
12 | // Toggle planSelection feature | ||
13 | reaction( | ||
14 | () => features.features.isPlanSelectionEnabled, | ||
15 | (isEnabled) => { | ||
16 | if (isEnabled) { | ||
17 | debug('Initializing `planSelection` feature'); | ||
18 | planSelectionStore.start(stores, actions); | ||
19 | } else if (planSelectionStore.isFeatureActive) { | ||
20 | debug('Disabling `planSelection` feature'); | ||
21 | planSelectionStore.stop(); | ||
22 | } | ||
23 | }, | ||
24 | { | ||
25 | fireImmediately: true, | ||
26 | }, | ||
27 | ); | ||
28 | } | ||