aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/settingsWS/index.js
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2019-04-16 14:17:31 +0200
committerLibravatar Stefan Malzner <stefan@adlk.io>2019-04-16 14:17:31 +0200
commite6535eb6d3b8700335076950a8ca531be8cde175 (patch)
tree0cf45078f9a0135f11d2c37fbc272b5657087742 /src/features/settingsWS/index.js
parentfix feature store test (diff)
downloadferdium-app-e6535eb6d3b8700335076950a8ca531be8cde175.tar.gz
ferdium-app-e6535eb6d3b8700335076950a8ca531be8cde175.tar.zst
ferdium-app-e6535eb6d3b8700335076950a8ca531be8cde175.zip
Refactor settingsWS Store to new FeatureStore
Diffstat (limited to 'src/features/settingsWS/index.js')
-rwxr-xr-xsrc/features/settingsWS/index.js16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/features/settingsWS/index.js b/src/features/settingsWS/index.js
index 4049ae814..2064d2973 100755
--- a/src/features/settingsWS/index.js
+++ b/src/features/settingsWS/index.js
@@ -1,10 +1,9 @@
1import { reaction, runInAction } from 'mobx'; 1import { reaction } from 'mobx';
2import { SettingsWSStore } from './store'; 2import { SettingsWSStore } from './store';
3import state, { resetState } from './state';
4 3
5const debug = require('debug')('Franz:feature:settingsWS'); 4const debug = require('debug')('Franz:feature:settingsWS');
6 5
7let store = null; 6export const settingsStore = new SettingsWSStore();
8 7
9export default function initSettingsWebSocket(stores, actions) { 8export default function initSettingsWebSocket(stores, actions) {
10 const { features } = stores; 9 const { features } = stores;
@@ -17,15 +16,10 @@ export default function initSettingsWebSocket(stores, actions) {
17 (isEnabled) => { 16 (isEnabled) => {
18 if (isEnabled) { 17 if (isEnabled) {
19 debug('Initializing `settingsWS` feature'); 18 debug('Initializing `settingsWS` feature');
20 store = new SettingsWSStore(stores, null, actions, state); 19 settingsStore.start(stores, actions);
21 store.initialize(); 20 } else if (settingsStore) {
22 runInAction(() => { state.isFeatureActive = true; });
23 } else if (store) {
24 debug('Disabling `settingsWS` feature'); 21 debug('Disabling `settingsWS` feature');
25 runInAction(() => { state.isFeatureActive = false; }); 22 settingsStore.stop();
26 store.teardown();
27 store = null;
28 resetState(); // Reset state to default
29 } 23 }
30 }, 24 },
31 { 25 {