Remove Common/Enums Magics.*

This commit is contained in:
djmaze 2020-08-13 22:58:41 +02:00
parent 382aef7ebb
commit 6541a1de7c
38 changed files with 135 additions and 219 deletions

View file

@ -1,7 +1,5 @@
import ko from 'ko';
import { Magics } from 'Common/Enums';
import AppStore from 'Stores/User/App';
import ContactStore from 'Stores/User/Contact';
import Remote from 'Remote/User/Ajax';
@ -25,7 +23,7 @@ class ContactsUserSettings {
this.contactsSyncPass()
].join('|')
)
.extend({ throttle: Magics.Time500ms });
.extend({ throttle: 500 });
}
onBuild() {

View file

@ -1,6 +1,6 @@
import ko from 'ko';
import { ClientSideKeyName, Notification, Magics } from 'Common/Enums';
import { ClientSideKeyName, Notification } from 'Common/Enums';
import { getNotification, i18n } from 'Common/Translator';
import { removeFolderFromCacheList } from 'Common/Cache';
@ -22,7 +22,7 @@ class FoldersUserSettings {
this.displaySpecSetting = FolderStore.displaySpecSetting;
this.folderList = FolderStore.folderList;
this.folderListHelp = ko.observable('').extend({ throttle: Magics.Time100ms });
this.folderListHelp = ko.observable('').extend({ throttle: 100 });
this.loading = ko.computed(() => {
const loading = FolderStore.foldersLoading(),

View file

@ -2,7 +2,7 @@ import ko from 'ko';
import { MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
import { SaveSettingsStep, Magics, EditorDefaultType, Layout } from 'Common/Enums';
import { SaveSettingsStep, EditorDefaultType, Layout } from 'Common/Enums';
import { settingsSaveHelperSimpleFunction, convertLangName, timeOutAction } from 'Common/Utils';
@ -45,7 +45,7 @@ class GeneralUserSettings {
this.allowLanguagesOnSettings = AppStore.allowLanguagesOnSettings;
this.languageFullName = ko.computed(() => convertLangName(this.language()));
this.languageTrigger = ko.observable(SaveSettingsStep.Idle).extend({ throttle: Magics.Time100ms });
this.languageTrigger = ko.observable(SaveSettingsStep.Idle).extend({ throttle: 100 });
this.mppTrigger = ko.observable(SaveSettingsStep.Idle);
this.editorDefaultTypeTrigger = ko.observable(SaveSettingsStep.Idle);
@ -101,7 +101,7 @@ class GeneralUserSettings {
f2 = settingsSaveHelperSimpleFunction(this.layoutTrigger, this),
fReloadLanguageHelper = (saveSettingsStep) => () => {
this.languageTrigger(saveSettingsStep);
setTimeout(() => this.languageTrigger(SaveSettingsStep.Idle), Magics.Time1s);
setTimeout(() => this.languageTrigger(SaveSettingsStep.Idle), 1000);
};
this.language.subscribe((value) => {
@ -129,7 +129,7 @@ class GeneralUserSettings {
'DesktopNotifications': value ? '1' : '0'
});
},
Magics.Time3s
3000
);
});
@ -141,7 +141,7 @@ class GeneralUserSettings {
'SoundNotification': value ? '1' : '0'
});
},
Magics.Time3s
3000
);
});
@ -153,7 +153,7 @@ class GeneralUserSettings {
'ReplySameFolder': value ? '1' : '0'
});
},
Magics.Time3s
3000
);
});
@ -170,7 +170,7 @@ class GeneralUserSettings {
'Layout': value
});
});
}, Magics.Time50ms);
}, 50);
}
onShow() {

View file

@ -1,7 +1,6 @@
import ko from 'ko';
import { delegateRunOnDestroy } from 'Common/Utils';
import { Magics } from 'Common/Enums';
import PgpStore from 'Stores/User/Pgp';
import SettingsStore from 'Stores/User/Settings';
@ -64,7 +63,7 @@ class OpenPgpUserSettings {
onBuild() {
setTimeout(() => {
this.allowDraftAutosave.subscribe(Remote.saveSettingsHelper('AllowDraftAutosave', v=>v?'1':'0'));
}, Magics.Time50ms);
}, 50);
}
}

View file

@ -1,6 +1,6 @@
import ko from 'ko';
import { SaveSettingsStep, UploadErrorCode, Capa, Magics } from 'Common/Enums';
import { SaveSettingsStep, UploadErrorCode, Capa } from 'Common/Enums';
import { changeTheme, convertThemeName } from 'Common/Utils';
import { userBackground, themePreviewLink, uploadBackground } from 'Common/Links';
import { i18n } from 'Common/Translator';
@ -26,7 +26,7 @@ class ThemesUserSettings {
this.capaUserBackground = ko.observable(capa(Capa.UserBackground));
this.themeTrigger = ko.observable(SaveSettingsStep.Idle).extend({ throttle: Magics.Time100ms });
this.themeTrigger = ko.observable(SaveSettingsStep.Idle).extend({ throttle: 100 });
this.iTimer = 0;
this.oThemeAjaxRequest = null;