diff options
author | Stefan <stefan@adlk.io> | 2019-06-04 14:26:56 +0200 |
---|---|---|
committer | Stefan <stefan@adlk.io> | 2019-06-04 14:26:56 +0200 |
commit | fd6a1e9ba24c7947af08a30829c860cad4726f67 (patch) | |
tree | 0b6276700ced8d13eaf0a1e3b706a69a5a47b1da /src/features/settingsWS/index.js | |
parent | fix(Windows): Replace tray icon with high-res version (diff) | |
parent | Merge pull request #1443 from meetfranz/feature/multilingual-announcements (diff) | |
download | ferdium-app-fd6a1e9ba24c7947af08a30829c860cad4726f67.tar.gz ferdium-app-fd6a1e9ba24c7947af08a30829c860cad4726f67.tar.zst ferdium-app-fd6a1e9ba24c7947af08a30829c860cad4726f67.zip |
Merge branch 'develop' of https://github.com/meetfranz/franz into develop
Diffstat (limited to 'src/features/settingsWS/index.js')
-rwxr-xr-x | src/features/settingsWS/index.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/features/settingsWS/index.js b/src/features/settingsWS/index.js new file mode 100755 index 000000000..2064d2973 --- /dev/null +++ b/src/features/settingsWS/index.js | |||
@@ -0,0 +1,29 @@ | |||
1 | import { reaction } from 'mobx'; | ||
2 | import { SettingsWSStore } from './store'; | ||
3 | |||
4 | const debug = require('debug')('Franz:feature:settingsWS'); | ||
5 | |||
6 | export const settingsStore = new SettingsWSStore(); | ||
7 | |||
8 | export default function initSettingsWebSocket(stores, actions) { | ||
9 | const { features } = stores; | ||
10 | |||
11 | // Toggle SettingsWebSocket feature | ||
12 | reaction( | ||
13 | () => ( | ||
14 | features.features.isSettingsWSEnabled | ||
15 | ), | ||
16 | (isEnabled) => { | ||
17 | if (isEnabled) { | ||
18 | debug('Initializing `settingsWS` feature'); | ||
19 | settingsStore.start(stores, actions); | ||
20 | } else if (settingsStore) { | ||
21 | debug('Disabling `settingsWS` feature'); | ||
22 | settingsStore.stop(); | ||
23 | } | ||
24 | }, | ||
25 | { | ||
26 | fireImmediately: true, | ||
27 | }, | ||
28 | ); | ||
29 | } | ||