blob: fa93bb615b14d103666ffeb5659160c1904b8c8d (
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
29
30
31
32
33
|
import { reaction } from 'mobx';
import { ServiceLimitStore } from './store';
const debug = require('debug')('Ferdi:feature:serviceLimit');
export const DEFAULT_SERVICE_LIMIT = 3;
let store = null;
export const serviceLimitStore = new ServiceLimitStore();
export default function initServiceLimit(stores, actions) {
const { features } = stores;
// Toggle serviceLimit feature
reaction(
() => (
features.features.isServiceLimitEnabled
),
(isEnabled) => {
if (isEnabled) {
debug('Initializing `serviceLimit` feature');
store = serviceLimitStore.start(stores, actions);
} else if (store) {
debug('Disabling `serviceLimit` feature');
serviceLimitStore.stop();
}
},
{
fireImmediately: true,
},
);
}
|