Underscore.js _.delay() to native setTimeout()

This commit is contained in:
djmaze 2020-07-22 20:28:25 +02:00
parent a82575a830
commit 43c92a82e6
29 changed files with 67 additions and 82 deletions

View file

@ -1,4 +1,3 @@
import _ from '_';
import ko from 'ko';
import { Magics } from 'Common/Enums';
@ -41,7 +40,7 @@ class BrandingAdminSettings {
}
onBuild() {
_.delay(() => {
setTimeout(() => {
const f1 = settingsSaveHelperSimpleFunction(this.title.trigger, this),
f2 = settingsSaveHelperSimpleFunction(this.loadingDesc.trigger, this),
f3 = settingsSaveHelperSimpleFunction(this.faviconUrl.trigger, this);

View file

@ -1,4 +1,3 @@
import _ from '_';
import ko from 'ko';
import { settingsSaveHelperSimpleFunction, defautOptionsAfterRender, trim, boolToAjax } from 'Common/Utils';
@ -144,7 +143,7 @@ class ContactsAdminSettings {
}
onBuild() {
_.delay(() => {
setTimeout(() => {
const f1 = settingsSaveHelperSimpleFunction(this.pdoDsnTrigger, this),
f3 = settingsSaveHelperSimpleFunction(this.pdoUserTrigger, this),
f4 = settingsSaveHelperSimpleFunction(this.pdoPasswordTrigger, this),

View file

@ -1,4 +1,3 @@
import _ from '_';
import ko from 'ko';
import {
@ -76,13 +75,13 @@ class GeneralAdminSettings {
}
onBuild() {
_.delay(() => {
setTimeout(() => {
const f1 = settingsSaveHelperSimpleFunction(this.attachmentLimitTrigger, this),
f2 = settingsSaveHelperSimpleFunction(this.languageTrigger, this),
f3 = settingsSaveHelperSimpleFunction(this.themeTrigger, this),
fReloadLanguageHelper = (saveSettingsStep) => () => {
this.languageAdminTrigger(saveSettingsStep);
_.delay(() => this.languageAdminTrigger(SaveSettingsStep.Idle), Magics.Time1s);
setTimeout(() => this.languageAdminTrigger(SaveSettingsStep.Idle), Magics.Time1s);
};
this.mainAttachmentLimit.subscribe((value) => {

View file

@ -1,4 +1,3 @@
import _ from '_';
import ko from 'ko';
import { settingsSaveHelperSimpleFunction, boolToAjax, trim } from 'Common/Utils';
@ -20,7 +19,7 @@ class LoginAdminSettings {
}
onBuild() {
_.delay(() => {
setTimeout(() => {
const f1 = settingsSaveHelperSimpleFunction(this.defaultDomain.trigger, this);
this.determineUserLanguage.subscribe((value) => {

View file

@ -1,4 +1,3 @@
import _ from '_';
import { settingsSaveHelperSimpleFunction, trim } from 'Common/Utils';
import { Magics } from 'Common/Enums';
@ -11,7 +10,7 @@ class BrandingPremAdminSettings extends BrandingAdminSettings {
super.onBuild(dom);
if (this.capa && this.capa() && !this.community) {
_.delay(() => {
setTimeout(() => {
const f1 = settingsSaveHelperSimpleFunction(this.loginLogo.trigger, this),
f2 = settingsSaveHelperSimpleFunction(this.loginDescription.trigger, this),
f3 = settingsSaveHelperSimpleFunction(this.loginCss.trigger, this),

View file

@ -1,4 +1,3 @@
import _ from '_';
import ko from 'ko';
import { trim, boolToAjax } from 'Common/Utils';
@ -105,7 +104,7 @@ class SecurityAdminSettings {
this.twoFactorDropperUser('');
this.isTwoFactorDropperShown(true);
_.delay(() => {
setTimeout(() => {
this.twoFactorDropperUser.focused(true);
}, Magics.Time50ms);
}

View file

@ -1,4 +1,3 @@
import _ from '_';
import ko from 'ko';
import { MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
@ -96,13 +95,13 @@ class GeneralUserSettings {
}
onBuild() {
_.delay(() => {
setTimeout(() => {
const f0 = settingsSaveHelperSimpleFunction(this.editorDefaultTypeTrigger, this),
f1 = settingsSaveHelperSimpleFunction(this.mppTrigger, this),
f2 = settingsSaveHelperSimpleFunction(this.layoutTrigger, this),
fReloadLanguageHelper = (saveSettingsStep) => () => {
this.languageTrigger(saveSettingsStep);
_.delay(() => this.languageTrigger(SaveSettingsStep.Idle), Magics.Time1s);
setTimeout(() => this.languageTrigger(SaveSettingsStep.Idle), Magics.Time1s);
};
this.language.subscribe((value) => {

View file

@ -1,4 +1,3 @@
import _ from '_';
import ko from 'ko';
import { delegateRunOnDestroy, boolToAjax } from 'Common/Utils';
@ -66,7 +65,7 @@ class OpenPgpUserSettings {
}
onBuild() {
_.delay(() => {
setTimeout(() => {
this.allowDraftAutosave.subscribe(Remote.saveSettingsHelper('AllowDraftAutosave', boolToAjax));
}, Magics.Time50ms);
}

View file

@ -1,4 +1,3 @@
import _ from '_';
import ko from 'ko';
import { pInt, settingsSaveHelperSimpleFunction } from 'Common/Utils';
@ -42,7 +41,7 @@ class SecurityUserSettings {
onBuild() {
if (this.capaAutoLogout) {
_.delay(() => {
setTimeout(() => {
const f0 = settingsSaveHelperSimpleFunction(this.autoLogout.trigger, this);
this.autoLogout.subscribe(Remote.saveSettingsHelper('AutoLogout', pInt, f0));