diff options
author | Markus Hatvan <markus_hatvan@aon.at> | 2021-10-02 09:24:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-02 09:24:32 +0200 |
commit | bfe8847d72cd0893230f2e654242658214943e61 (patch) | |
tree | 3384b02ebad7a74cbb106ddd95546e0e24ff0bb8 /src/features/todos/index.ts | |
parent | fix: Fix navigation shortcut accelerator for non-macos (fixes #1172) (#2012) (diff) | |
download | ferdium-app-bfe8847d72cd0893230f2e654242658214943e61.tar.gz ferdium-app-bfe8847d72cd0893230f2e654242658214943e61.tar.zst ferdium-app-bfe8847d72cd0893230f2e654242658214943e61.zip |
chore: convert various files from JS to TS (#2010)
Diffstat (limited to 'src/features/todos/index.ts')
-rw-r--r-- | src/features/todos/index.ts | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/features/todos/index.ts b/src/features/todos/index.ts new file mode 100644 index 000000000..3665812e6 --- /dev/null +++ b/src/features/todos/index.ts | |||
@@ -0,0 +1,29 @@ | |||
1 | import { reaction } from 'mobx'; | ||
2 | import TodoStore from './store'; | ||
3 | |||
4 | const debug = require('debug')('Ferdi:feature:todos'); | ||
5 | |||
6 | export const todosStore = new TodoStore(); | ||
7 | |||
8 | export default function initTodos( | ||
9 | stores: { todos?: any; features?: any }, | ||
10 | actions: any, | ||
11 | ) { | ||
12 | stores.todos = todosStore; | ||
13 | const { features } = stores; | ||
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 | } | ||