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

@ -508,7 +508,7 @@ class ComposePopupView extends AbstractViewNext {
contactsCommand() {
if (this.allowContacts) {
this.skipCommand();
_.delay(() => {
setTimeout(() => {
showScreenPopup(require('View/Popup/Contacts'), [true, this.sLastFocusedField]);
}, Magics.Time200ms);
}
@ -706,7 +706,7 @@ class ComposePopupView extends AbstractViewNext {
editor(fOnInit) {
if (fOnInit) {
if (!this.oEditor && this.composeEditorArea()) {
// _.delay(() => {
// setTimeout(() => {
this.oEditor = new HtmlEditor(
this.composeEditorArea(),
null,
@ -1169,7 +1169,7 @@ class ComposePopupView extends AbstractViewNext {
setFocusInPopup() {
if (!bMobileDevice) {
_.delay(() => {
setTimeout(() => {
if ('' === this.to()) {
this.to.focused(true);
} else if (this.oEditor) {

View file

@ -178,7 +178,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
}
if (result && this.resultCallback) {
_.delay(() => {
setTimeout(() => {
let pgpPromise = null;
try {

View file

@ -276,7 +276,7 @@ class ContactsPopupView extends AbstractViewNext {
this.sLastComposeFocusedField = '';
_.delay(() => {
setTimeout(() => {
showScreenPopup(require('View/Popup/Compose'), [ComposeType.Empty, null, toEmails, ccEmails, bccEmails]);
}, Magics.Time200ms);
}
@ -327,14 +327,14 @@ class ContactsPopupView extends AbstractViewNext {
res = true;
}
_.delay(() => {
setTimeout(() => {
this.viewSaveTrigger(res ? SaveSettingsStep.TrueResult : SaveSettingsStep.FalseResult);
}, Magics.Time350ms);
if (res) {
this.watchDirty(false);
_.delay(() => {
setTimeout(() => {
this.viewSaveTrigger(SaveSettingsStep.Idle);
}, Magics.Time1s);
}
@ -470,7 +470,7 @@ class ContactsPopupView extends AbstractViewNext {
this.bDropPageAfterDelete = true;
}
_.delay(() => {
setTimeout(() => {
contacts.forEach(contact => {
koContacts.remove(contact);
delegateRunOnDestroy(contact);
@ -495,7 +495,7 @@ class ContactsPopupView extends AbstractViewNext {
if (Magics.Time500ms < (StorageResultType.Success === sResult && oData && oData.Time ? pInt(oData.Time) : 0)) {
this.reloadContactList(this.bDropPageAfterDelete);
} else {
_.delay(() => {
setTimeout(() => {
this.reloadContactList(this.bDropPageAfterDelete);
}, Magics.Time500ms);
}

View file

@ -1,4 +1,3 @@
import _ from '_';
import ko from 'ko';
import key from 'key';
import $ from '$';
@ -37,7 +36,7 @@ class MessageOpenPgpPopupView extends AbstractViewNext {
doCommand() {
this.submitRequest(true);
_.delay(() => {
setTimeout(() => {
let privateKey = null;
try {

View file

@ -1,4 +1,3 @@
import _ from '_';
import ko from 'ko';
import { Magics } from 'Common/Enums';
@ -53,7 +52,7 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext {
this.submitRequest(true);
this.submitError('');
_.delay(() => {
setTimeout(() => {
try {
PgpStore.openpgp
.generateKey({