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

@ -131,7 +131,7 @@ class AbstractApp extends AbstractBoot {
} }
redirectToAdminPanel() { redirectToAdminPanel() {
_.delay(() => { setTimeout(() => {
window.location.href = rootAdmin(); window.location.href = rootAdmin();
}, Magics.Time100ms); }, Magics.Time100ms);
} }
@ -174,7 +174,7 @@ class AbstractApp extends AbstractBoot {
customLogoutLink = customLogoutLink || (admin ? rootAdmin() : rootUser()); customLogoutLink = customLogoutLink || (admin ? rootAdmin() : rootUser());
if (logout && window.location.href !== customLogoutLink) { if (logout && window.location.href !== customLogoutLink) {
_.delay(() => { setTimeout(() => {
if (inIframe && window.parent) { if (inIframe && window.parent) {
window.parent.location.href = customLogoutLink; window.parent.location.href = customLogoutLink;
} else { } else {
@ -188,7 +188,7 @@ class AbstractApp extends AbstractBoot {
setHash(root(), true); setHash(root(), true);
routeOff(); routeOff();
_.delay(() => { setTimeout(() => {
if (inIframe && window.parent) { if (inIframe && window.parent) {
window.parent.location.reload(); window.parent.location.reload();
} else { } else {
@ -233,7 +233,7 @@ class AbstractApp extends AbstractBoot {
initOnStartOrLangChange(initNotificationLanguage); initOnStartOrLangChange(initNotificationLanguage);
_.delay(windowResizeCallback, Magics.Time1s); setTimeout(windowResizeCallback, Magics.Time1s);
Events.sub('ssm.mobile-enter', () => { Events.sub('ssm.mobile-enter', () => {
leftPanelDisabled(true); leftPanelDisabled(true);

View file

@ -173,7 +173,7 @@ class AppUser extends AbstractApp {
} }
if (Settings.settingsGet('UserBackgroundHash')) { if (Settings.settingsGet('UserBackgroundHash')) {
_.delay(() => { setTimeout(() => {
const img = userBackground(Settings.settingsGet('UserBackgroundHash')); const img = userBackground(Settings.settingsGet('UserBackgroundHash'));
if (img) { if (img) {
$htmlCL.add('UserBackground'); $htmlCL.add('UserBackground');
@ -455,7 +455,7 @@ class AppUser extends AbstractApp {
.then((value) => !!value) .then((value) => !!value)
.then(callback) .then(callback)
.catch(() => { .catch(() => {
_.delay(() => { setTimeout(() => {
if (callback) { if (callback) {
callback(false); // eslint-disable-line callback-return callback(false); // eslint-disable-line callback-return
} }
@ -597,7 +597,7 @@ class AppUser extends AbstractApp {
} }
if (isUnd(bBoot) ? false : !!bBoot) { if (isUnd(bBoot) ? false : !!bBoot) {
_.delay(() => this.accountsCounts(), 1000 * 5); setTimeout(() => this.accountsCounts(), 1000 * 5);
Events.sub('interval.10m-after5m', () => this.accountsCounts()); Events.sub('interval.10m-after5m', () => this.accountsCounts());
} }
@ -797,7 +797,7 @@ class AppUser extends AbstractApp {
}); });
if (boot) { if (boot) {
_.delay(() => this.folderInformationMultiply(true), 2000); setTimeout(() => this.folderInformationMultiply(true), 2000);
} }
} }
} }
@ -1141,22 +1141,22 @@ class AppUser extends AbstractApp {
contactsSyncInterval = 5 <= contactsSyncInterval ? contactsSyncInterval : 20; contactsSyncInterval = 5 <= contactsSyncInterval ? contactsSyncInterval : 20;
contactsSyncInterval = 320 >= contactsSyncInterval ? contactsSyncInterval : 320; contactsSyncInterval = 320 >= contactsSyncInterval ? contactsSyncInterval : 320;
_.delay(() => this.contactsSync(), Magics.Time10s); setTimeout(() => this.contactsSync(), Magics.Time10s);
_.delay(() => this.folderInformationMultiply(true), Magics.Time2s); setTimeout(() => this.folderInformationMultiply(true), Magics.Time2s);
window.setInterval(() => this.contactsSync(), contactsSyncInterval * 60000 + 5000); window.setInterval(() => this.contactsSync(), contactsSyncInterval * 60000 + 5000);
this.accountsAndIdentities(true); this.accountsAndIdentities(true);
_.delay(() => { setTimeout(() => {
const sF = FolderStore.currentFolderFullNameRaw(); const sF = FolderStore.currentFolderFullNameRaw();
if (getFolderInboxName() !== sF) { if (getFolderInboxName() !== sF) {
this.folderInformation(sF); this.folderInformation(sF);
} }
}, 1000); }, 1000);
_.delay(() => this.quota(), 5000); setTimeout(() => this.quota(), 5000);
_.delay(() => Remote.appDelayStart(noop), 35000); setTimeout(() => Remote.appDelayStart(noop), 35000);
Events.sub('rl.auto-logout', () => this.logout()); Events.sub('rl.auto-logout', () => this.logout());
@ -1164,7 +1164,7 @@ class AppUser extends AbstractApp {
Events.pub('rl.bootstart-user-screens'); Events.pub('rl.bootstart-user-screens');
if (Settings.settingsGet('WelcomePageUrl')) { if (Settings.settingsGet('WelcomePageUrl')) {
_.delay(() => this.bootstartWelcomePopup(Settings.settingsGet('WelcomePageUrl')), 1000); setTimeout(() => this.bootstartWelcomePopup(Settings.settingsGet('WelcomePageUrl')), 1000);
} }
if ( if (
@ -1172,7 +1172,7 @@ class AppUser extends AbstractApp {
window.navigator.registerProtocolHandler && window.navigator.registerProtocolHandler &&
Settings.capa(Capa.Composer) Settings.capa(Capa.Composer)
) { ) {
_.delay(() => { setTimeout(() => {
try { try {
window.navigator.registerProtocolHandler( window.navigator.registerProtocolHandler(
'mailto', 'mailto',

View file

@ -222,7 +222,7 @@ class Selector {
this.scrollToFocused(); this.scrollToFocused();
_.delay(() => this.scrollToFocused(), 100); setTimeout(this.scrollToFocused, 100);
} }
this.iSelectNextHelper = 0; this.iSelectNextHelper = 0;

View file

@ -270,7 +270,7 @@ export function reload(admin, language) {
cache: true cache: true
}).then( }).then(
() => { () => {
_.delay( setTimeout(
() => { () => {
reloadData(); reloadData();

View file

@ -380,7 +380,7 @@ export function delegateRun(object, methodName, params, delay = 0) {
if (0 >= delay) { if (0 >= delay) {
object[methodName](...params); object[methodName](...params);
} else { } else {
_.delay(() => { setTimeout(() => {
object[methodName](...params); object[methodName](...params);
}, delay); }, delay);
} }
@ -597,7 +597,7 @@ export function settingsSaveHelperFunction(fCallback, koTrigger, context = null,
if (fCallback) { if (fCallback) {
fCallback.call(context, type, data, cached, requestAction, requestParameters); fCallback.call(context, type, data, cached, requestAction, requestParameters);
} }
_.delay(() => { setTimeout(() => {
koTrigger.call(context, SaveSettingsStep.Idle); koTrigger.call(context, SaveSettingsStep.Idle);
}, timer); }, timer);
}; };
@ -1029,7 +1029,7 @@ export function triggerAutocompleteInputChange(delay = false) {
}; };
if (delay) { if (delay) {
_.delay(fFunc, 100); setTimeout(fFunc, 100);
} else { } else {
fFunc(); fFunc();
} }

View file

@ -1,4 +1,3 @@
import _ from '_';
import ko from 'ko'; import ko from 'ko';
import { componentExportHelper } from 'Component/Abstract'; import { componentExportHelper } from 'Component/Abstract';
import { AbstractCheckbox } from 'Component/AbstractCheckbox'; import { AbstractCheckbox } from 'Component/AbstractCheckbox';
@ -34,10 +33,10 @@ class CheckboxMaterialDesignComponent extends AbstractCheckbox {
triggerAnimation(box) { triggerAnimation(box) {
if (box) { if (box) {
this.animationBoxSetTrue(); this.animationBoxSetTrue();
_.delay(this.animationCheckmarkSetTrue, 200); setTimeout(this.animationCheckmarkSetTrue, 200);
} else { } else {
this.animationCheckmarkSetTrue(); this.animationCheckmarkSetTrue();
_.delay(this.animationBoxSetTrue, 200); setTimeout(this.animationBoxSetTrue, 200);
} }
} }
} }

12
dev/External/ko.js vendored
View file

@ -21,7 +21,7 @@ ko.bindingHandlers.updateWidth = {
fValue = fValueAccessor(), fValue = fValueAccessor(),
fInit = () => { fInit = () => {
fValue($el.width()); fValue($el.width());
window.setTimeout(() => { setTimeout(() => {
fValue($el.width()); fValue($el.width());
}, Magics.Time500ms); }, Magics.Time500ms);
}; };
@ -127,7 +127,7 @@ ko.bindingHandlers.visibleAnimated = {
const $el = $(element); const $el = $(element);
if (ko.unwrap(fValueAccessor())) { if (ko.unwrap(fValueAccessor())) {
$el.addClass('rl-animated-hidden').show(); $el.addClass('rl-animated-hidden').show();
_.delay(() => { setTimeout(() => {
$el.removeClass('rl-animated-hidden'); $el.removeClass('rl-animated-hidden');
}, 10); }, 10);
} else { } else {
@ -249,7 +249,7 @@ ko.bindingHandlers.tooltipErrorTip = {
openTips.deactivate(); openTips.deactivate();
openTips.setContent(''); openTips.setContent('');
} else { } else {
_.delay(() => { setTimeout(() => {
if ($el.is(':visible')) { if ($el.is(':visible')) {
openTips.setContent(value); openTips.setContent(value);
openTips.activate(); openTips.activate();
@ -461,7 +461,7 @@ ko.bindingHandlers.modal = {
if (Globals.$htmlCL.contains('rl-anim')) { if (Globals.$htmlCL.contains('rl-anim')) {
Globals.$htmlCL.add('rl-modal-animation'); Globals.$htmlCL.add('rl-modal-animation');
_.delay(() => { setTimeout(() => {
Globals.$htmlCL.remove('rl-modal-animation'); Globals.$htmlCL.remove('rl-modal-animation');
}, Magics.Time500ms); }, Magics.Time500ms);
} }
@ -1031,7 +1031,7 @@ ko.extenders.falseTimeout = (target, option) => {
target.subscribe((value) => { target.subscribe((value) => {
if (value) { if (value) {
window.clearTimeout(target.iFalseTimeoutTimeout); window.clearTimeout(target.iFalseTimeoutTimeout);
target.iFalseTimeoutTimeout = window.setTimeout(() => { target.iFalseTimeoutTimeout = setTimeout(() => {
target(false); target(false);
target.iFalseTimeoutTimeout = 0; target.iFalseTimeoutTimeout = 0;
}, require('Common/Utils').pInt(option)); }, require('Common/Utils').pInt(option));
@ -1055,7 +1055,7 @@ ko.extenders.specialThrottle = (target, option) => {
} else { } else {
if (target.valueForRead()) { if (target.valueForRead()) {
window.clearTimeout(target.iSpecialThrottleTimeout); window.clearTimeout(target.iSpecialThrottleTimeout);
target.iSpecialThrottleTimeout = window.setTimeout(() => { target.iSpecialThrottleTimeout = setTimeout(() => {
target.valueForRead(false); target.valueForRead(false);
target.iSpecialThrottleTimeout = 0; target.iSpecialThrottleTimeout = 0;
}, target.iSpecialThrottleTimeoutValue); }, target.iSpecialThrottleTimeoutValue);

View file

@ -202,7 +202,7 @@ export function buildViewModel(ViewModelClass, vmScreen) {
popupVisibilityNames.remove(vm.viewModelName); popupVisibilityNames.remove(vm.viewModelName);
vm.viewModelDom.css('z-index', 2000); vm.viewModelDom.css('z-index', 2000);
_.delay(() => vm.viewModelDom.hide(), 300); setTimeout(() => vm.viewModelDom.hide(), 300);
} }
}); });
} }
@ -432,11 +432,11 @@ export function startScreens(screensClasses) {
hasher.changed.add(cross.parse, cross); hasher.changed.add(cross.parse, cross);
hasher.init(); hasher.init();
_.delay(() => { setTimeout(() => {
$htmlCL.remove('rl-started-trigger'); $htmlCL.remove('rl-started-trigger');
$htmlCL.add('rl-started'); $htmlCL.add('rl-started');
}, 100); }, 100);
_.delay(() => $htmlCL.add('rl-started-delay'), 200); setTimeout(() => $htmlCL.add('rl-started-delay'), 200);
} }
/** /**

View file

@ -856,7 +856,7 @@ class MessageModel extends AbstractModel {
if (lazy) { if (lazy) {
// $('.RL-MailMessageView .messageView .messageItem .content')[0] // $('.RL-MailMessageView .messageView .messageItem .content')[0]
_.delay(() => this.lozad(), 300); setTimeout(() => this.lozad(), 300);
} }
windowResize(500); windowResize(500);

View file

@ -109,8 +109,8 @@ class MailBoxUserScreen extends AbstractScreen {
MessageStore.messageList.subscribe(windowResizeCallback); MessageStore.messageList.subscribe(windowResizeCallback);
MessageStore.message.subscribe(windowResizeCallback); MessageStore.message.subscribe(windowResizeCallback);
_.delay(() => SettingsStore.layout.valueHasMutated(), Magics.Time50ms); setTimeout(() => SettingsStore.layout.valueHasMutated(), Magics.Time50ms);
_.delay(() => warmUpScreenPopup(require('View/Popup/Compose')), Magics.Time500ms); setTimeout(() => warmUpScreenPopup(require('View/Popup/Compose')), Magics.Time500ms);
Events.sub('mailbox.inbox-unread-count', (count) => { Events.sub('mailbox.inbox-unread-count', (count) => {
FolderStore.foldersInboxUnreadCount(count); FolderStore.foldersInboxUnreadCount(count);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -239,7 +239,7 @@ class MessageUserStore {
}); });
if (0 < count) { if (0 < count) {
_.delay(() => messagesDom.find('.rl-cache-purge').remove(), Magics.Time350ms); setTimeout(() => messagesDom.find('.rl-cache-purge').remove(), Magics.Time350ms);
} }
} }
} }
@ -358,7 +358,7 @@ class MessageUserStore {
item.deleted(true); item.deleted(true);
}); });
_.delay(() => { setTimeout(() => {
messages.forEach(item => { messages.forEach(item => {
this.messageList.remove(item); this.messageList.remove(item);
}); });

View file

@ -1,5 +1,4 @@
import ko from 'ko'; import ko from 'ko';
import _ from '_';
import { trim, triggerAutocompleteInputChange } from 'Common/Utils'; import { trim, triggerAutocompleteInputChange } from 'Common/Utils';
@ -103,7 +102,7 @@ class LoginAdminView extends AbstractViewNext {
onShow() { onShow() {
routeOff(); routeOff();
_.delay(() => { setTimeout(() => {
this.loginFocus(true); this.loginFocus(true);
}, Magics.Time100ms); }, Magics.Time100ms);
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,3 @@
import _ from '_';
import ko from 'ko'; import ko from 'ko';
import key from 'key'; import key from 'key';
@ -54,7 +53,7 @@ class AbstractSystemDropDownUserView extends AbstractViewNext {
accountClick(account, event) { accountClick(account, event) {
if (account && event && !isUnd(event.which) && 1 === event.which) { if (account && event && !isUnd(event.which) && 1 === event.which) {
AccountStore.accounts.loading(true); AccountStore.accounts.loading(true);
_.delay(() => AccountStore.accounts.loading(false), Magics.Time1s); setTimeout(() => AccountStore.accounts.loading(false), Magics.Time1s);
} }
return true; return true;

View file

@ -1,4 +1,3 @@
import _ from '_';
import ko from 'ko'; import ko from 'ko';
import { import {
@ -217,7 +216,7 @@ class LoginUserView extends AbstractViewNext {
this.additionalCode.visibility(true); this.additionalCode.visibility(true);
this.submitRequest(false); this.submitRequest(false);
_.delay(() => this.additionalCode.focused(true), Magics.Time100ms); setTimeout(() => this.additionalCode.focused(true), Magics.Time100ms);
} else if (oData.Admin) { } else if (oData.Admin) {
getApp().redirectToAdminPanel(); getApp().redirectToAdminPanel();
} else { } else {
@ -317,7 +316,7 @@ class LoginUserView extends AbstractViewNext {
this.email(AppStore.devEmail); this.email(AppStore.devEmail);
this.password(AppStore.devPassword); this.password(AppStore.devPassword);
_.delay(() => { setTimeout(() => {
LanguageStore.language.subscribe((value) => { LanguageStore.language.subscribe((value) => {
this.langRequest(true); this.langRequest(true);
@ -346,7 +345,7 @@ class LoginUserView extends AbstractViewNext {
selectLanguageOnTab(bShift) { selectLanguageOnTab(bShift) {
if (!bShift) { if (!bShift) {
_.delay(() => { setTimeout(() => {
this.emailFocus(true); this.emailFocus(true);
}, Magics.Time50ms); }, Magics.Time50ms);

View file

@ -262,7 +262,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
if (message) { if (message) {
this.showAttachmnetControls(false); this.showAttachmnetControls(false);
if (Local.get(ClientSideKeyName.MessageAttachmnetControls)) { if (Local.get(ClientSideKeyName.MessageAttachmnetControls)) {
_.delay(() => { setTimeout(() => {
this.showAttachmnetControls(true); this.showAttachmnetControls(true);
}, Magics.Time50ms); }, Magics.Time50ms);
} }
@ -547,9 +547,9 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
Events.sub( Events.sub(
'window.resize', 'window.resize',
_.throttle(() => { _.throttle(() => {
_.delay(fCheckHeaderHeight, 1); setTimeout(fCheckHeaderHeight, 1);
_.delay(fCheckHeaderHeight, Magics.Time200ms); setTimeout(fCheckHeaderHeight, Magics.Time200ms);
_.delay(fCheckHeaderHeight, Magics.Time500ms); setTimeout(fCheckHeaderHeight, Magics.Time500ms);
}, Magics.Time50ms) }, Magics.Time50ms)
); );