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

@ -2,7 +2,6 @@ import ko from 'ko';
import {
Capa,
Magics,
KeyState,
ComposeType,
StorageResultType,
@ -328,7 +327,7 @@ class ComposePopupView extends AbstractViewNext {
var d, fn = this.tryToClosePopup.bind(this);
this.tryToClosePopup = ()=>{
d && clearTimeout(d);
d = setTimeout(fn, Magics.Time200ms);
d = setTimeout(fn, 200);
};
this.emailsSource = this.emailsSource.bind(this);
@ -506,7 +505,7 @@ class ComposePopupView extends AbstractViewNext {
this.skipCommand();
setTimeout(() => {
showScreenPopup(require('View/Popup/Contacts'), [true, this.sLastFocusedField]);
}, Magics.Time200ms);
}, 200);
}
}
@ -528,7 +527,7 @@ class ComposePopupView extends AbstractViewNext {
autosaveStart() {
clearTimeout(this.iTimer);
this.iTimer = setTimeout(this.autosaveFunction, Magics.Time1m);
this.iTimer = setTimeout(this.autosaveFunction, 60000);
}
autosaveStop() {
@ -1174,7 +1173,7 @@ class ComposePopupView extends AbstractViewNext {
this.oEditor.focus();
}
}
}, Magics.Time100ms);
}, 100);
}
}
@ -1250,14 +1249,14 @@ class ComposePopupView extends AbstractViewNext {
Events.sub('window.resize.real', ()=>{
// debounce
d && clearTimeout(d);
d = setTimeout(o.resizerTrigger, Magics.Time50ms);
d = setTimeout(o.resizerTrigger, 50);
});
setInterval(() => {
if (this.modalVisibility() && this.oEditor) {
this.oEditor.resize();
}
}, Magics.Time5s);
}, 5000);
}
/**

View file

@ -2,7 +2,7 @@ import ko from 'ko';
import { pString, defautOptionsAfterRender } from 'Common/Utils';
import { Magics, KeyState } from 'Common/Enums';
import { KeyState } from 'Common/Enums';
import { i18n } from 'Common/Translator';
import PgpStore from 'Stores/User/Pgp';
@ -234,7 +234,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
}
this.submitRequest(false);
}, Magics.Time20ms);
}, 20);
} else {
this.submitRequest(false);
}

View file

@ -5,7 +5,6 @@ import {
ContactPropertyType,
ComposeType,
Capa,
Magics,
StorageResultType,
Notification,
KeyState
@ -274,7 +273,7 @@ class ContactsPopupView extends AbstractViewNext {
setTimeout(() => {
showScreenPopup(require('View/Popup/Compose'), [ComposeType.Empty, null, toEmails, ccEmails, bccEmails]);
}, Magics.Time200ms);
}, 200);
}
return true;
@ -325,14 +324,14 @@ class ContactsPopupView extends AbstractViewNext {
setTimeout(() => {
this.viewSaveTrigger(res ? SaveSettingsStep.TrueResult : SaveSettingsStep.FalseResult);
}, Magics.Time350ms);
}, 350);
if (res) {
this.watchDirty(false);
setTimeout(() => {
this.viewSaveTrigger(SaveSettingsStep.Idle);
}, Magics.Time1s);
}, 1000);
}
},
requestUid,
@ -471,7 +470,7 @@ class ContactsPopupView extends AbstractViewNext {
koContacts.remove(contact);
delegateRunOnDestroy(contact);
});
}, Magics.Time500ms);
}, 500);
}
}
@ -488,12 +487,12 @@ class ContactsPopupView extends AbstractViewNext {
* @param {AjaxJsonDefaultResponse} oData
*/
deleteResponse(sResult, oData) {
if (Magics.Time500ms < (StorageResultType.Success === sResult && oData && oData.Time ? pInt(oData.Time) : 0)) {
if (500 < (StorageResultType.Success === sResult && oData && oData.Time ? pInt(oData.Time) : 0)) {
this.reloadContactList(this.bDropPageAfterDelete);
} else {
setTimeout(() => {
this.reloadContactList(this.bDropPageAfterDelete);
}, Magics.Time500ms);
}, 500);
}
}

View file

@ -1,6 +1,6 @@
import ko from 'ko';
import { SetSystemFoldersNotification, Magics } from 'Common/Enums';
import { SetSystemFoldersNotification } from 'Common/Enums';
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { folderListOptionsBuilder, defautOptionsAfterRender } from 'Common/Utils';
import { initOnStartOrLangChange, i18n } from 'Common/Translator';
@ -76,7 +76,7 @@ class FolderSystemPopupView extends AbstractViewNext {
ArchiveFolder: FolderStore.archiveFolder(),
NullFolder: 'NullFolder'
});
}, Magics.Time1s);
}, 1000);
},
fCallback = () => {
fSetSystemFolders();

View file

@ -1,4 +1,4 @@
import { KeyState, Magics } from 'Common/Enums';
import { KeyState } from 'Common/Enums';
import { popup } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
@ -44,7 +44,7 @@ class KeyboardShortcutsHelpPopupView extends AbstractViewNext {
}
return true;
}, Magics.Time100ms);
}, 100);
}
}
);

View file

@ -1,7 +1,7 @@
import ko from 'ko';
import { pString } from 'Common/Utils';
import { KeyState, Magics } from 'Common/Enums';
import { KeyState } from 'Common/Enums';
import { popup, command } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
@ -65,7 +65,7 @@ class MessageOpenPgpPopupView extends AbstractViewNext {
this.cancelCommand();
this.resultCallback(privateKey);
}, Magics.Time100ms);
}, 100);
}
clearPopup() {

View file

@ -1,6 +1,5 @@
import ko from 'ko';
import { Magics } from 'Common/Enums';
import { delegateRun, pInt } from 'Common/Utils';
import PgpStore from 'Stores/User/Pgp';
@ -24,7 +23,7 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext {
this.name = ko.observable('');
this.password = ko.observable('');
this.keyBitLength = ko.observable(Magics.BitLength2048);
this.keyBitLength = ko.observable(2048);
this.submitRequest = ko.observable(false);
this.submitError = ko.observable('');
@ -81,7 +80,7 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext {
this.submitRequest(false);
this.showError(e);
}
}, Magics.Time100ms);
}, 100);
return true;
}
@ -99,7 +98,7 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext {
this.email('');
this.email.error(false);
this.keyBitLength(Magics.BitLength2048);
this.keyBitLength(2048);
this.submitError('');
}

View file

@ -1,6 +1,6 @@
import ko from 'ko';
import { KeyState, Magics, StorageResultType, Notification } from 'Common/Enums';
import { KeyState, StorageResultType, Notification } from 'Common/Enums';
import { isNonEmptyArray, delegateRun } from 'Common/Utils';
import { getNotification, i18n } from 'Common/Translator';
@ -45,7 +45,7 @@ class PluginPopupView extends AbstractViewNext {
this.tryToClosePopup = ()=>{
// debounce
d && clearTimeout(d);
d = setTimeout(fn, Magics.Time200ms);
d = setTimeout(fn, 200);
};
}