blob: 0dfd35c78712911eb5f6078cd4d4194582781687 (
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 TodoStore from './store';
const debug = require('debug')('Franz:feature:todos');
export const GA_CATEGORY_TODOS = 'Todos';
export const DEFAULT_TODOS_WIDTH = 300;
export const TODOS_MIN_WIDTH = 200;
export const todoStore = new TodoStore();
export default function initTodos(stores, actions) {
stores.todos = todoStore;
const { features } = stores;
// Toggle todos feature
reaction(
() => features.features.isTodosEnabled,
(isEnabled) => {
if (isEnabled) {
debug('Initializing `todos` feature');
todoStore.start(stores, actions);
} else if (todoStore.isFeatureActive) {
debug('Disabling `todos` feature');
todoStore.stop();
}
},
{
fireImmediately: true,
},
);
}
|