diff options
author | 2021-10-27 07:25:26 +0530 | |
---|---|---|
committer | 2021-10-27 07:25:26 +0530 | |
commit | 477bdd76a7405ff10a5cfabdec00ee9ae02f2698 (patch) | |
tree | bfa8cfb70e6852b9f535ccfd9b05712269a70dc1 /src/features/todos/index.ts | |
parent | Bumped up ferdi beta version to '5.6.3-beta.2' (diff) | |
parent | 5.6.3-nightly.44 [skip ci] (diff) | |
download | ferdium-app-477bdd76a7405ff10a5cfabdec00ee9ae02f2698.tar.gz ferdium-app-477bdd76a7405ff10a5cfabdec00ee9ae02f2698.tar.zst ferdium-app-477bdd76a7405ff10a5cfabdec00ee9ae02f2698.zip |
Merge branch 'nightly' into release
Diffstat (limited to 'src/features/todos/index.ts')
-rw-r--r-- | src/features/todos/index.ts | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/src/features/todos/index.ts b/src/features/todos/index.ts index 3665812e6..2fa8c3130 100644 --- a/src/features/todos/index.ts +++ b/src/features/todos/index.ts | |||
@@ -1,29 +1,8 @@ | |||
1 | import { reaction } from 'mobx'; | ||
2 | import TodoStore from './store'; | 1 | import TodoStore from './store'; |
3 | 2 | ||
4 | const debug = require('debug')('Ferdi:feature:todos'); | ||
5 | |||
6 | export const todosStore = new TodoStore(); | 3 | export const todosStore = new TodoStore(); |
7 | 4 | ||
8 | export default function initTodos( | 5 | export default function initTodos(stores: { todos?: any }, actions: any) { |
9 | stores: { todos?: any; features?: any }, | ||
10 | actions: any, | ||
11 | ) { | ||
12 | stores.todos = todosStore; | 6 | stores.todos = todosStore; |
13 | const { features } = stores; | 7 | todosStore.start(stores, actions); |
14 | |||
15 | // Toggle todos feature | ||
16 | reaction( | ||
17 | () => features.features.isTodosEnabled, | ||
18 | isEnabled => { | ||
19 | if (isEnabled) { | ||
20 | debug('Initializing `todos` feature'); | ||
21 | todosStore.start(stores, actions); | ||
22 | } else if (todosStore.isFeatureActive) { | ||
23 | debug('Disabling `todos` feature'); | ||
24 | todosStore.stop(); | ||
25 | } | ||
26 | }, | ||
27 | { fireImmediately: true }, | ||
28 | ); | ||
29 | } | 8 | } |