diff options
Diffstat (limited to 'src/features/todos/index.js')
-rw-r--r-- | src/features/todos/index.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/features/todos/index.js b/src/features/todos/index.js new file mode 100644 index 000000000..0dfd35c78 --- /dev/null +++ b/src/features/todos/index.js | |||
@@ -0,0 +1,33 @@ | |||
1 | import { reaction } from 'mobx'; | ||
2 | import TodoStore from './store'; | ||
3 | |||
4 | const debug = require('debug')('Franz:feature:todos'); | ||
5 | |||
6 | export const GA_CATEGORY_TODOS = 'Todos'; | ||
7 | |||
8 | export const DEFAULT_TODOS_WIDTH = 300; | ||
9 | export const TODOS_MIN_WIDTH = 200; | ||
10 | |||
11 | export const todoStore = new TodoStore(); | ||
12 | |||
13 | export default function initTodos(stores, actions) { | ||
14 | stores.todos = todoStore; | ||
15 | const { features } = stores; | ||
16 | |||
17 | // Toggle todos feature | ||
18 | reaction( | ||
19 | () => features.features.isTodosEnabled, | ||
20 | (isEnabled) => { | ||
21 | if (isEnabled) { | ||
22 | debug('Initializing `todos` feature'); | ||
23 | todoStore.start(stores, actions); | ||
24 | } else if (todoStore.isFeatureActive) { | ||
25 | debug('Disabling `todos` feature'); | ||
26 | todoStore.stop(); | ||
27 | } | ||
28 | }, | ||
29 | { | ||
30 | fireImmediately: true, | ||
31 | }, | ||
32 | ); | ||
33 | } | ||