Convert user stores to single object instances

Removed unused ContactUserStore.exportingCsv and ContactUserStore.exportingVcf
This commit is contained in:
djmaze 2021-03-10 22:41:35 +01:00
parent 914c6e8d14
commit 6a454ec624
46 changed files with 671 additions and 710 deletions

View file

@ -6,7 +6,7 @@ import { pInt } from 'Common/Utils';
import { $htmlCL, SettingsGet } from 'Common/Globals';
import { ThemeStore } from 'Stores/Theme';
class SettingsUserStore {
export const SettingsUserStore = new class {
constructor() {
this.layout = ko
.observable(Layout.SidePreview)
@ -36,7 +36,12 @@ class SettingsUserStore {
this.usePreviewPane = ko.computed(() => Layout.NoPreview !== this.layout() && !ThemeStore.isMobile());
this.subscribers();
this.layout.subscribe(value => {
$htmlCL.toggle('rl-no-preview-pane', Layout.NoPreview === value);
$htmlCL.toggle('rl-side-preview-pane', Layout.SidePreview === value);
$htmlCL.toggle('rl-bottom-preview-pane', Layout.BottomPreview === value);
dispatchEvent(new CustomEvent('rl-layout', {detail:value}));
});
let iAutoLogoutTimer;
this.delayLogout = (() => {
@ -50,15 +55,6 @@ class SettingsUserStore {
}).throttle(5000);
}
subscribers() {
this.layout.subscribe(value => {
$htmlCL.toggle('rl-no-preview-pane', Layout.NoPreview === value);
$htmlCL.toggle('rl-side-preview-pane', Layout.SidePreview === value);
$htmlCL.toggle('rl-bottom-preview-pane', Layout.BottomPreview === value);
dispatchEvent(new CustomEvent('rl-layout', {detail:value}));
});
}
populate() {
this.layout(pInt(SettingsGet('Layout')));
this.editorDefaultType(SettingsGet('EditorDefaultType'));
@ -75,6 +71,4 @@ class SettingsUserStore {
this.delayLogout();
}
}
export default new SettingsUserStore();
};