aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/workspaces/index.ts
diff options
context:
space:
mode:
authorLibravatar Markus Hatvan <markus_hatvan@aon.at>2021-09-18 11:15:25 +0200
committerLibravatar GitHub <noreply@github.com>2021-09-18 11:15:25 +0200
commitd4101a48b3eee8b1fb177831aa02a4b4fbec2588 (patch)
treec92f2fbe91197fde8589207463d0d6526b4ff76b /src/features/workspaces/index.ts
parent5.6.3-nightly.6 [skip ci] (diff)
downloadferdium-app-d4101a48b3eee8b1fb177831aa02a4b4fbec2588.tar.gz
ferdium-app-d4101a48b3eee8b1fb177831aa02a4b4fbec2588.tar.zst
ferdium-app-d4101a48b3eee8b1fb177831aa02a4b4fbec2588.zip
chore: convert various files from JS to TS (#1959)
Diffstat (limited to 'src/features/workspaces/index.ts')
-rw-r--r--src/features/workspaces/index.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/features/workspaces/index.ts b/src/features/workspaces/index.ts
new file mode 100644
index 000000000..ecca64b41
--- /dev/null
+++ b/src/features/workspaces/index.ts
@@ -0,0 +1,28 @@
1import { reaction } from 'mobx';
2import WorkspacesStore from './store';
3import { resetApiRequests } from './api';
4
5const debug = require('debug')('Ferdi:feature:workspaces');
6
7export const workspaceStore = new WorkspacesStore();
8
9export default function initWorkspaces(stores, actions) {
10 stores.workspaces = workspaceStore;
11 const { features } = stores;
12
13 // Toggle workspace feature
14 reaction(
15 () => features.features.isWorkspaceEnabled,
16 isEnabled => {
17 if (isEnabled && !workspaceStore.isFeatureActive) {
18 debug('Initializing `workspaces` feature');
19 workspaceStore.start(stores, actions);
20 } else if (workspaceStore.isFeatureActive) {
21 debug('Disabling `workspaces` feature');
22 workspaceStore.stop();
23 resetApiRequests();
24 }
25 },
26 { fireImmediately: true },
27 );
28}