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

@ -10,7 +10,7 @@ import {
import { isNormal, pString, detectDropdownVisibility, windowResizeCallback } from 'Common/Utils';
import { KeyState, Magics } from 'Common/Enums';
import { KeyState } from 'Common/Enums';
import { root, rootAdmin, rootUser, populateAuthSuffix } from 'Common/Links';
import { initOnStartOrLangChange, initNotificationLanguage } from 'Common/Translator';
import * as Events from 'Common/Events';
@ -32,9 +32,7 @@ class AbstractApp extends AbstractBoot {
this.isLocalAutocomplete = true;
this.lastErrorTime = 0;
addEventListener('resize', () => {
Events.pub('window.resize');
});
addEventListener('resize', () => Events.pub('window.resize'));
var t;
Events.sub(
@ -53,7 +51,7 @@ class AbstractApp extends AbstractBoot {
Events.pub('window.resize.real');
}
t = 0;
}, Magics.Time50ms);
}, 50);
}
}
);
@ -84,7 +82,7 @@ class AbstractApp extends AbstractBoot {
const fn = ()=>{
// debounce
d && clearTimeout(d);
d = setTimeout(()=>Events.pub('rl.auto-logout-refresh'), Magics.Time5s);
d = setTimeout(()=>Events.pub('rl.auto-logout-refresh'), 5000);
}
$doc.addEventListener('mousemove', fn);
@ -141,7 +139,7 @@ class AbstractApp extends AbstractBoot {
redirectToAdminPanel() {
setTimeout(() => {
location.href = rootAdmin();
}, Magics.Time100ms);
}, 100);
}
clearClientSideToken() {
@ -190,7 +188,7 @@ class AbstractApp extends AbstractBoot {
}
$win.trigger('rl.tooltips.diactivate');
}, Magics.Time100ms);
}, 100);
} else {
routeOff();
setHash(root(), true);
@ -204,7 +202,7 @@ class AbstractApp extends AbstractBoot {
}
$win.trigger('rl.tooltips.diactivate');
}, Magics.Time100ms);
}, 100);
}
}
@ -239,15 +237,11 @@ class AbstractApp extends AbstractBoot {
initOnStartOrLangChange(initNotificationLanguage);
setTimeout(windowResizeCallback, Magics.Time1s);
setTimeout(windowResizeCallback, 1000);
Events.sub('ssm.mobile-enter', () => {
leftPanelDisabled(true);
});
Events.sub('ssm.mobile-enter', () => leftPanelDisabled(true));
Events.sub('ssm.mobile-leave', () => {
leftPanelDisabled(false);
});
Events.sub('ssm.mobile-leave', () => leftPanelDisabled(false));
if (!mobile) {
$htmlCL.add('rl-desktop');
@ -268,34 +262,22 @@ class AbstractApp extends AbstractBoot {
ssm.addState({
id: 'tablet',
query: '(min-width: 768px) and (max-width: 999px)',
onEnter: () => {
$htmlCL.add('ssm-state-tablet');
},
onLeave: () => {
$htmlCL.remove('ssm-state-tablet');
}
onEnter: () => $htmlCL.add('ssm-state-tablet'),
onLeave: () => $htmlCL.remove('ssm-state-tablet')
});
ssm.addState({
id: 'desktop',
query: '(min-width: 1000px) and (max-width: 1400px)',
onEnter: () => {
$htmlCL.add('ssm-state-desktop');
},
onLeave: () => {
$htmlCL.remove('ssm-state-desktop');
}
onEnter: () => $htmlCL.add('ssm-state-desktop'),
onLeave: () => $htmlCL.remove('ssm-state-desktop')
});
ssm.addState({
id: 'desktop-large',
query: '(min-width: 1401px)',
onEnter: () => {
$htmlCL.add('ssm-state-desktop-large');
},
onLeave: () => {
$htmlCL.remove('ssm-state-desktop-large');
}
onEnter: () => $htmlCL.add('ssm-state-desktop-large'),
onLeave: () => $htmlCL.remove('ssm-state-desktop-large')
});
} else {
$htmlCL.add('ssm-state-mobile', 'rl-mobile');

View file

@ -16,8 +16,7 @@ import {
FolderType,
SetSystemFoldersNotification,
MessageSetAction,
ClientSideKeyName,
Magics
ClientSideKeyName
} from 'Common/Enums';
import { $htmlCL, leftPanelDisabled, bMobileDevice } from 'Common/Globals';
@ -125,29 +124,26 @@ class AppUser extends AbstractApp {
this.quotaDebounce = ()=>{
// debounce
qd && clearTimeout(qd);
qd = setTimeout(o.quota, Magics.Time30s);
qd = setTimeout(o.quota, 30000);
};
this.moveOrDeleteResponseHelper = this.moveOrDeleteResponseHelper.bind(this);
setInterval(() => Events.pub('interval.30s'), Magics.Time30s);
setInterval(() => Events.pub('interval.1m'), Magics.Time1m);
setInterval(() => Events.pub('interval.2m'), Magics.Time2m);
setInterval(() => Events.pub('interval.3m'), Magics.Time3m);
setInterval(() => Events.pub('interval.5m'), Magics.Time5m);
setInterval(() => Events.pub('interval.10m'), Magics.Time10m);
setInterval(() => Events.pub('interval.15m'), Magics.Time15m);
setInterval(() => Events.pub('interval.20m'), Magics.Time20m);
setInterval(() => Events.pub('interval.30s'), 30000);
setInterval(() => Events.pub('interval.1m'), 60000);
setInterval(() => Events.pub('interval.2m'), 120000);
setInterval(() => Events.pub('interval.3m'), 180000);
setInterval(() => Events.pub('interval.5m'), 300000);
setInterval(() => Events.pub('interval.10m'), 600000);
setInterval(() => Events.pub('interval.15m'), 900000);
setInterval(() => Events.pub('interval.20m'), 1200000);
setTimeout(() => setInterval(() => Events.pub('interval.2m-after5m'), Magics.Time2m), Magics.Time5m);
setTimeout(() => setInterval(() => Events.pub('interval.5m-after5m'), Magics.Time5m), Magics.Time5m);
setTimeout(
() => setInterval(() => Events.pub('interval.10m-after5m'), Magics.Time10m),
Magics.Time5m
);
setTimeout(() => setInterval(() => Events.pub('interval.2m-after5m'), 120000), 300000);
setTimeout(() => setInterval(() => Events.pub('interval.5m-after5m'), 300000), 300000);
setTimeout(() => setInterval(() => Events.pub('interval.10m-after5m'), 600000), 300000);
// wakeUp
const interval = Magics.Time60m;
const interval = 3600000; // 60m
var lastTime = (new Date()).getTime();
setInterval(() => {
const currentTime = (new Date()).getTime();
@ -175,7 +171,7 @@ class AppUser extends AbstractApp {
$htmlCL.add('UserBackground');
doc.body.style.backgroundImage = "url("+img+")";
}
}, Magics.Time1s);
}, 1000);
}
}
@ -1145,8 +1141,8 @@ class AppUser extends AbstractApp {
contactsSyncInterval = 5 <= contactsSyncInterval ? contactsSyncInterval : 20;
contactsSyncInterval = 320 >= contactsSyncInterval ? contactsSyncInterval : 320;
setTimeout(() => this.contactsSync(), Magics.Time10s);
setTimeout(() => this.folderInformationMultiply(true), Magics.Time2s);
setTimeout(() => this.contactsSync(), 10000);
setTimeout(() => this.folderInformationMultiply(true), 2000);
setInterval(() => this.contactsSync(), contactsSyncInterval * 60000 + 5000);

View file

@ -455,48 +455,6 @@ export const ContactPropertyType = {
'Custom': 250
};
/**
* @enum {number}
*/
export const Magics = {
'EventWhichMouseMiddle': 3,
'BitLength2048': 2048,
'BitLength1024': 1024,
'Size350px': 350,
'Size50px': 50,
'Size20px': 20,
'Size1px': 1,
'Time30mInMin': 30,
'Time60m': 60000 * 60,
'Time30m': 60000 * 30,
'Time20m': 60000 * 20,
'Time15m': 60000 * 15,
'Time10m': 60000 * 10,
'Time5m': 60000 * 5,
'Time3m': 60000 * 3,
'Time2m': 60000 * 2,
'Time1m': 60000,
'Time30s': 30000,
'Time10s': 10000,
'Time7s': 7000,
'Time5s': 5000,
'Time3s': 3000,
'Time1s': 1000,
'Time500ms': 500,
'Time350ms': 350,
'Time250ms': 250,
'Time200ms': 200,
'Time100ms': 100,
'Time50ms': 50,
'Time20ms': 20,
'Time10ms': 10,
'Time1ms': 1
};
/**
* @enum {number}
*/

View file

@ -1,5 +1,5 @@
import { htmlEditorDefaultConfig, htmlEditorLangsMap } from 'Common/Globals';
import { EventKeyCode, Magics } from 'Common/Enums';
import { EventKeyCode } from 'Common/Enums';
import * as Settings from 'Storage/Settings';
class HtmlEditor {
@ -57,7 +57,7 @@ class HtmlEditor {
clearTimeout(this.blurTimer);
this.blurTimer = setTimeout(() => {
this.runOnBlur();
}, Magics.Time200ms);
}, 200);
}
}

6
dev/External/ko.js vendored
View file

@ -1,4 +1,4 @@
import { SaveSettingsStep, Magics } from 'Common/Enums';
import { SaveSettingsStep } from 'Common/Enums';
const
$ = jQuery,
@ -152,7 +152,7 @@ ko.bindingHandlers.tooltipErrorTip = {
value = !ko.isObservable(fValue) && isFunction(fValue) ? fValue() : ko.unwrap(fValue);
if (value) {
setTimeout(() => element.setAttribute('data-rainloopErrorTip', value), Magics.Time100ms);
setTimeout(() => element.setAttribute('data-rainloopErrorTip', value), 100);
} else {
element.removeAttribute('data-rainloopErrorTip');
}
@ -329,7 +329,7 @@ ko.bindingHandlers.modal = {
Globals.$htmlCL.add('rl-modal-animation');
setTimeout(() => {
Globals.$htmlCL.remove('rl-modal-animation');
}, Magics.Time500ms);
}, 500);
}
}
};

View file

@ -1,6 +1,5 @@
import ko from 'ko';
import { Magics } from 'Common/Enums';
import { runHook } from 'Common/Plugins';
import { $htmlCL, VIEW_MODELS, popupVisibilityNames } from 'Common/Globals';
@ -548,7 +547,7 @@ function settingsMenuKeysHandler($items) {
}
}
t = 0;
}, Magics.Time200ms);
}, 200);
}
};
}

View file

@ -1,4 +1,4 @@
import { Focused, Capa, ClientSideKeyName, Magics } from 'Common/Enums';
import { Focused, Capa, ClientSideKeyName } from 'Common/Enums';
import { $html, leftPanelDisabled, leftPanelType, moveAction, bMobileDevice } from 'Common/Globals';
import { pString, pInt, windowResizeCallback } from 'Common/Utils';
import { getFolderFromCacheList, getFolderFullNameRaw, getFolderInboxName } from 'Common/Cache';
@ -107,8 +107,8 @@ class MailBoxUserScreen extends AbstractScreen {
MessageStore.messageList.subscribe(windowResizeCallback);
MessageStore.message.subscribe(windowResizeCallback);
setTimeout(() => SettingsStore.layout.valueHasMutated(), Magics.Time50ms);
setTimeout(() => warmUpScreenPopup(require('View/Popup/Compose')), Magics.Time500ms);
setTimeout(() => SettingsStore.layout.valueHasMutated(), 50);
setTimeout(() => warmUpScreenPopup(require('View/Popup/Compose')), 500);
Events.sub('mailbox.inbox-unread-count', (count) => {
FolderStore.foldersInboxUnreadCount(count);

View file

@ -1,6 +1,5 @@
import ko from 'ko';
import { Magics } from 'Common/Enums';
import { settingsSaveHelperSimpleFunction } from 'Common/Utils';
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
@ -62,7 +61,7 @@ class BrandingAdminSettings {
'FaviconUrl': value.trim()
});
});
}, Magics.Time50ms);
}, 50);
}
}

View file

@ -2,7 +2,7 @@ import ko from 'ko';
import { settingsSaveHelperSimpleFunction, defautOptionsAfterRender } from 'Common/Utils';
import { SaveSettingsStep, StorageResultType, Magics } from 'Common/Enums';
import { SaveSettingsStep, StorageResultType } from 'Common/Enums';
import { i18n } from 'Common/Translator';
import { settingsGet } from 'Storage/Settings';
import Remote from 'Remote/Admin/Ajax';
@ -186,7 +186,7 @@ class ContactsAdminSettings {
});
this.contactsType(settingsGet('ContactsPdoType'));
}, Magics.Time50ms);
}, 50);
}
}

View file

@ -8,7 +8,7 @@ import {
convertLangName
} from 'Common/Utils';
import { SaveSettingsStep, Magics } from 'Common/Enums';
import { SaveSettingsStep } from 'Common/Enums';
import { reload as translatorReload } from 'Common/Translator';
import { settingsGet } from 'Storage/Settings';
@ -45,7 +45,7 @@ class GeneralAdminSettings {
this.dataFolderAccess = AppAdminStore.dataFolderAccess;
this.mainAttachmentLimit = ko
.observable(pInt(settingsGet('AttachmentLimit')) / (Magics.BitLength1024 * Magics.BitLength1024))
.observable(pInt(settingsGet('AttachmentLimit')) / (1024 * 1024))
.extend({ posInterer: 25 });
this.uploadData = settingsGet('PhpUploadSizes');
@ -68,7 +68,7 @@ class GeneralAdminSettings {
this.attachmentLimitTrigger = ko.observable(SaveSettingsStep.Idle);
this.languageTrigger = ko.observable(SaveSettingsStep.Idle);
this.languageAdminTrigger = ko.observable(SaveSettingsStep.Idle).extend({ throttle: Magics.Time100ms });
this.languageAdminTrigger = ko.observable(SaveSettingsStep.Idle).extend({ throttle: 100 });
this.themeTrigger = ko.observable(SaveSettingsStep.Idle);
}
@ -79,7 +79,7 @@ class GeneralAdminSettings {
f3 = settingsSaveHelperSimpleFunction(this.themeTrigger, this),
fReloadLanguageHelper = (saveSettingsStep) => () => {
this.languageAdminTrigger(saveSettingsStep);
setTimeout(() => this.languageAdminTrigger(SaveSettingsStep.Idle), Magics.Time1s);
setTimeout(() => this.languageAdminTrigger(SaveSettingsStep.Idle), 1000);
};
this.mainAttachmentLimit.subscribe((value) => {
@ -159,7 +159,7 @@ class GeneralAdminSettings {
'NewMoveToFolder': value ? '1' : '0'
});
});
}, Magics.Time50ms);
}, 50);
}
selectLanguage() {

View file

@ -1,6 +1,6 @@
import ko from 'ko';
import { StorageResultType, Magics } from 'Common/Enums';
import { StorageResultType } from 'Common/Enums';
import { settingsGet } from 'Storage/Settings';
@ -105,7 +105,7 @@ class SecurityAdminSettings {
setTimeout(() => {
this.twoFactorDropperUser.focused(true);
}, Magics.Time50ms);
}, 50);
}
onNewAdminPasswordResponse(result, data) {

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;

View file

@ -1,5 +1,4 @@
import ko from 'ko';
import { Magics } from 'Common/Enums';
import * as Settings from 'Storage/Settings';
class AccountUserStore {
@ -10,7 +9,7 @@ class AccountUserStore {
this.signature = ko.observable('');
this.accounts = ko.observableArray([]);
this.accounts.loading = ko.observable(false).extend({ throttle: Magics.Time100ms });
this.accounts.loading = ko.observable(false).extend({ throttle: 100 });
this.computers();
}

View file

@ -1,15 +1,14 @@
import ko from 'ko';
import { Magics } from 'Common/Enums';
import * as Settings from 'Storage/Settings';
class ContactUserStore {
constructor() {
this.contacts = ko.observableArray([]);
this.contacts.loading = ko.observable(false).extend({ throttle: Magics.Time200ms });
this.contacts.importing = ko.observable(false).extend({ throttle: Magics.Time200ms });
this.contacts.syncing = ko.observable(false).extend({ throttle: Magics.Time200ms });
this.contacts.exportingVcf = ko.observable(false).extend({ throttle: Magics.Time200ms });
this.contacts.exportingCsv = ko.observable(false).extend({ throttle: Magics.Time200ms });
this.contacts.loading = ko.observable(false).extend({ throttle: 200 });
this.contacts.importing = ko.observable(false).extend({ throttle: 200 });
this.contacts.syncing = ko.observable(false).extend({ throttle: 200 });
this.contacts.exportingVcf = ko.observable(false).extend({ throttle: 200 });
this.contacts.exportingCsv = ko.observable(false).extend({ throttle: 200 });
this.allowContactsSync = ko.observable(false);
this.enableContactsSync = ko.observable(false);

View file

@ -1,5 +1,4 @@
import ko from 'ko';
import { Magics } from 'Common/Enums';
class FilterUserStore {
constructor() {
@ -8,8 +7,8 @@ class FilterUserStore {
this.filters = ko.observableArray([]);
this.filters.loading = ko.observable(false).extend({ throttle: Magics.Time200ms });
this.filters.saving = ko.observable(false).extend({ throttle: Magics.Time200ms });
this.filters.loading = ko.observable(false).extend({ throttle: 200 });
this.filters.saving = ko.observable(false).extend({ throttle: 200 });
this.raw = ko.observable('');
}

View file

@ -1,6 +1,6 @@
import ko from 'ko';
import { Magics, Layout, Focused, MessageSetAction, StorageResultType, Notification } from 'Common/Enums';
import { Layout, Focused, MessageSetAction, StorageResultType, Notification } from 'Common/Enums';
import {
isNormal,
@ -102,7 +102,7 @@ class MessageUserStore {
this.messageCurrentLoading = ko.observable(false);
this.messageLoadingThrottle = ko.observable(false).extend({ throttle: Magics.Time50ms });
this.messageLoadingThrottle = ko.observable(false).extend({ throttle: 50 });
this.messageFullScreenMode = ko.observable(false);
@ -121,7 +121,7 @@ class MessageUserStore {
t = setTimeout(()=>{
o.purgeMessageBodyCache();
t = 0;
}, Magics.Time30s);
}, 30000);
}
};
}
@ -214,7 +214,7 @@ class MessageUserStore {
if (item && item.newForAnimation()) {
item.newForAnimation(false);
}
}), Magics.Time500ms);
}), 500);
}
);
@ -265,7 +265,7 @@ class MessageUserStore {
});
if (0 < count) {
setTimeout(() => messagesDom.find('.rl-cache-purge').remove(), Magics.Time350ms);
setTimeout(() => messagesDom.find('.rl-cache-purge').remove(), 350);
}
}
}
@ -388,7 +388,7 @@ class MessageUserStore {
messages.forEach(item => {
this.messageList.remove(item);
});
}, Magics.Time350ms);
}, 350);
}
}

View file

@ -1,6 +1,6 @@
import ko from 'ko';
import { DesktopNotification, Magics } from 'Common/Enums';
import { DesktopNotification } from 'Common/Enums';
import * as Events from 'Common/Events';
import Audio from 'Common/Audio';
@ -153,7 +153,7 @@ class NotificationUserStore {
}
};
})(notification),
Magics.Time7s
7000
);
}
}

View file

@ -1,7 +1,5 @@
import ko from 'ko';
import { Magics } from 'Common/Enums';
class QuotaUserStore {
constructor() {
this.quota = ko.observable(0);
@ -20,8 +18,8 @@ class QuotaUserStore {
* @param {number} usage
*/
populateData(quota, usage) {
this.quota(quota * Magics.BitLength1024);
this.usage(usage * Magics.BitLength1024);
this.quota(quota * 1024);
this.usage(usage * 1024);
}
}

View file

@ -1,7 +1,7 @@
import ko from 'ko';
import { MESSAGES_PER_PAGE, MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
import { Layout, EditorDefaultType, Magics } from 'Common/Enums';
import { Layout, EditorDefaultType } from 'Common/Enums';
import { $htmlCL } from 'Common/Globals';
import { pInt } from 'Common/Utils';
import * as Events from 'Common/Events';
@ -33,7 +33,7 @@ class SettingsUserStore {
this.useThreads = ko.observable(false);
this.replySameFolder = ko.observable(false);
this.autoLogout = ko.observable(Magics.Time30mInMin);
this.autoLogout = ko.observable(30);
this.computers();
this.subscribers();
@ -70,7 +70,7 @@ class SettingsUserStore {
if (0 < this.autoLogout() && !Settings.settingsGet('AccountSignMe')) {
this.iAutoLogoutTimer = setTimeout(() => {
Events.pub('rl.auto-logout');
}, this.autoLogout() * Magics.Time1m);
}, this.autoLogout() * 60000);
}
});

View file

@ -2,7 +2,7 @@ import ko from 'ko';
import { triggerAutocompleteInputChange } from 'Common/Utils';
import { StorageResultType, Notification, Magics } from 'Common/Enums';
import { StorageResultType, Notification } from 'Common/Enums';
import { getNotification } from 'Common/Translator';
import { $win } from 'Common/Globals';
@ -104,7 +104,7 @@ class LoginAdminView extends AbstractViewNext {
setTimeout(() => {
this.loginFocus(true);
}, Magics.Time100ms);
}, 100);
}
onHide() {

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);
};
}

View file

@ -4,7 +4,7 @@ import AppStore from 'Stores/User/App';
import AccountStore from 'Stores/User/Account';
import MessageStore from 'Stores/User/Message';
import { Capa, Magics, KeyState } from 'Common/Enums';
import { Capa, KeyState } from 'Common/Enums';
import { settings } from 'Common/Links';
import * as Events from 'Common/Events';
@ -51,7 +51,7 @@ class AbstractSystemDropDownUserView extends AbstractViewNext {
accountClick(account, event) {
if (account && event && undefined !== event.which && 1 === event.which) {
AccountStore.accounts.loading(true);
setTimeout(() => AccountStore.accounts.loading(false), Magics.Time1s);
setTimeout(() => AccountStore.accounts.loading(false), 1000);
}
return true;

View file

@ -5,7 +5,6 @@ import {
LoginSignMeTypeAsString,
ClientSideKeyName,
StorageResultType,
Magics,
Notification
} from 'Common/Enums';
@ -216,7 +215,7 @@ class LoginUserView extends AbstractViewNext {
this.additionalCode.visibility(true);
this.submitRequest(false);
setTimeout(() => this.additionalCode.focused(true), Magics.Time100ms);
setTimeout(() => this.additionalCode.focused(true), 100);
} else if (oData.Admin) {
getApp().redirectToAdminPanel();
} else {
@ -330,7 +329,7 @@ class LoginUserView extends AbstractViewNext {
}
);
});
}, Magics.Time50ms);
}, 50);
triggerAutocompleteInputChange(true);
}
@ -347,7 +346,7 @@ class LoginUserView extends AbstractViewNext {
if (!bShift) {
setTimeout(() => {
this.emailFocus(true);
}, Magics.Time50ms);
}, 50);
return false;
}

View file

@ -1,7 +1,7 @@
import ko from 'ko';
import { isNormal, windowResize } from 'Common/Utils';
import { Capa, Focused, Layout, KeyState, EventKeyCode, Magics } from 'Common/Enums';
import { Capa, Focused, Layout, KeyState, EventKeyCode } from 'Common/Enums';
import { $htmlCL, leftPanelDisabled, moveAction } from 'Common/Globals';
import { mailBox, settings } from 'Common/Links';
import { setFolderHash } from 'Common/Cache';
@ -199,7 +199,7 @@ class FolderListMailBoxUserView extends AbstractViewNext {
folder.collapsed(false);
getApp().setExpandedFolder(folder.fullNameHash, true);
windowResize();
}, Magics.Time500ms);
}, 500);
}
}

View file

@ -6,7 +6,6 @@ import {
Focused,
ComposeType,
FolderType,
Magics,
MessageSetAction,
KeyState,
StorageResultType
@ -434,7 +433,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
this.selector.unselect();
this.gotoPage(up ? prev : next);
}
}, Magics.Time350ms);
}, 350);
return true;
}
@ -775,11 +774,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
this.initShortcuts();
if (!bMobileDevice && ifvisible && Settings.capa(Capa.Prefetch)) {
ifvisible.setIdleDuration(Magics.ifvisibleIdle10s);
ifvisible.idle(() => {
this.prefetchNextTick();
});
ifvisible.idle(this.prefetchNextTick.bind(this));
}
}
@ -949,7 +944,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
if (next) {
this.prefetchNextTick();
}
}, Magics.Time1s);
}, 1000);
},
message.folderFullNameRaw,
message.uid

View file

@ -10,7 +10,6 @@ import {
FolderType,
Focused,
Layout,
Magics,
MessageSetAction
} from 'Common/Enums';
@ -259,7 +258,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
if (Local.get(ClientSideKeyName.MessageAttachmnetControls)) {
setTimeout(() => {
this.showAttachmnetControls(true);
}, Magics.Time50ms);
}, 50);
}
if (this.viewHash !== message.hash) {
@ -433,8 +432,8 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
this.viewBodyTopValue(
this.message()
? this.oHeaderDom.height() +
Magics.Size20px /* padding-(top/bottom): 20px */ +
Magics.Size1px /* borded-bottom: 1px */
20 /* padding-(top/bottom): 20px */ +
1 /* borded-bottom: 1px */
: 0
);
}
@ -545,17 +544,17 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
if (!t) {
t = setTimeout(()=>{
setTimeout(fCheckHeaderHeight, 1);
setTimeout(fCheckHeaderHeight, Magics.Time200ms);
setTimeout(fCheckHeaderHeight, Magics.Time500ms);
setTimeout(fCheckHeaderHeight, 200);
setTimeout(fCheckHeaderHeight, 500);
t = 0;
}, Magics.Time50ms);
}, 50);
}
}
);
this.showFullInfo.subscribe((value) => {
windowResize();
windowResize(Magics.Time200ms);
windowResize(200);
Local.set(ClientSideKeyName.MessageHeaderFullInfo, value ? '1' : '0');
});
@ -574,7 +573,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
// setup maito protocol
return !(
!!event &&
Magics.EventWhichMouseMiddle !== event.which &&
3 !== event.which &&
mailToHelper(
jQuery(this).attr('href'),
Settings.capa(Capa.Composer) ? require('View/Popup/Compose') : null // eslint-disable-line no-invalid-this
@ -865,8 +864,8 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
scrollMessageToTop() {
if (this.oMessageScrollerDom) {
if (Magics.Size50px < this.oMessageScrollerDom.scrollTop) {
this.oMessageScrollerDom.scrollTop = Magics.Size50px;
if (50 < this.oMessageScrollerDom.scrollTop) {
this.oMessageScrollerDom.scrollTop = 50;
} else {
this.oMessageScrollerDom.scrollTop = 0;
}

4
dev/bootstrap.js vendored
View file

@ -60,7 +60,7 @@ export default (App) => {
$htmlCL.add('rl-booted');
App.bootstart();
}, Enums.Magics.Time10ms);
}, 10);
};
window.__APP_BOOT = fErrorCallback => {
@ -74,7 +74,7 @@ export default (App) => {
}
window.__APP_BOOT = null;
}, Enums.Magics.Time10ms);
}, 10);
});
};
};