blob: 890be8871227eb4750bdf6ba61b4a278a5330da2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import { reaction } from 'mobx';
import PlanSelectionStore from './store';
const debug = require('debug')('Franz:feature:planSelection');
export const planSelectionStore = new PlanSelectionStore();
export default function initPlanSelection(stores, actions) {
stores.planSelection = planSelectionStore;
const { features } = stores;
// Toggle planSelection feature
reaction(
() => features.features.isPlanSelectionEnabled,
(isEnabled) => {
if (isEnabled) {
debug('Initializing `planSelection` feature');
planSelectionStore.start(stores, actions);
} else if (planSelectionStore.isFeatureActive) {
debug('Disabling `planSelection` feature');
planSelectionStore.stop();
}
},
{
fireImmediately: true,
},
);
}
|