mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 13:39:22 +03:00
Replace timeOutAction() with debounce
Replace delegateRun() Revert my throttle/debounce setTimeout() to Function.prototype[throttle/debounce]
This commit is contained in:
parent
f6a55898c7
commit
97a73c6639
28 changed files with 225 additions and 372 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { KeyState, StorageResultType, Notification } from 'Common/Enums';
|
||||
import { isNonEmptyArray, delegateRun } from 'Common/Utils';
|
||||
import { getNotification, i18n } from 'Common/Translator';
|
||||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
|
|
@ -41,12 +40,7 @@ class PluginPopupView extends AbstractViewNext {
|
|||
this.bDisabeCloseOnEsc = true;
|
||||
this.sDefaultKeyScope = KeyState.All;
|
||||
|
||||
var d, fn = this.tryToClosePopup.bind(this);
|
||||
this.tryToClosePopup = ()=>{
|
||||
// debounce
|
||||
clearTimeout(d);
|
||||
d = setTimeout(fn, 200);
|
||||
};
|
||||
this.tryToClosePopup = this.tryToClosePopup.debounce(200);
|
||||
}
|
||||
|
||||
@command((self) => self.hasConfiguration())
|
||||
|
|
@ -89,7 +83,7 @@ class PluginPopupView extends AbstractViewNext {
|
|||
this.readme(oPlugin.Readme);
|
||||
|
||||
const config = oPlugin.Config;
|
||||
if (isNonEmptyArray(config)) {
|
||||
if (Array.isArray(config) && config.length) {
|
||||
this.configures(
|
||||
config.map(item => ({
|
||||
'value': ko.observable(item[0]),
|
||||
|
|
@ -110,11 +104,7 @@ class PluginPopupView extends AbstractViewNext {
|
|||
if (!isPopupVisible(PopupsAskViewModel)) {
|
||||
showScreenPopup(PopupsAskViewModel, [
|
||||
i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'),
|
||||
() => {
|
||||
if (this.modalVisibility()) {
|
||||
delegateRun(this, 'cancelCommand');
|
||||
}
|
||||
}
|
||||
() => this.modalVisibility() && this.cancelCommand && this.cancelCommand()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue