_.bind(function, object) to function.bind(object)

This commit is contained in:
djmaze 2020-07-20 15:47:33 +02:00
parent db2d95d684
commit af136f46c4
23 changed files with 38 additions and 45 deletions

View file

@ -97,7 +97,7 @@ class ComposePopupView extends AbstractViewNext {
this.sLastFocusedField = 'to';
this.resizerTrigger = _.bind(this.resizerTrigger, this);
this.resizerTrigger = this.resizerTrigger.bind(this);
this.allowContacts = !!AppStore.contactsIsAllowed();
this.allowFolders = !!Settings.capa(Capa.Folders);
@ -307,8 +307,8 @@ class ComposePopupView extends AbstractViewNext {
this.canBeSentOrSaved = ko.computed(() => !this.sending() && !this.saving());
this.sendMessageResponse = _.bind(this.sendMessageResponse, this);
this.saveMessageResponse = _.bind(this.saveMessageResponse, this);
this.sendMessageResponse = this.sendMessageResponse.bind(this);
this.saveMessageResponse = this.saveMessageResponse.bind(this);
Events.sub('interval.2m', () => {
if (
@ -328,15 +328,15 @@ class ComposePopupView extends AbstractViewNext {
this.showBcc.subscribe(this.resizerTrigger);
this.showReplyTo.subscribe(this.resizerTrigger);
this.onMessageUploadAttachments = _.bind(this.onMessageUploadAttachments, this);
this.onMessageUploadAttachments = this.onMessageUploadAttachments.bind(this);
this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = KeyState.Compose;
this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), Magics.Time200ms);
this.tryToClosePopup = _.debounce(this.tryToClosePopup.bind(this), Magics.Time200ms);
this.emailsSource = _.bind(this.emailsSource, this);
this.autosaveFunction = _.bind(this.autosaveFunction, this);
this.emailsSource = this.emailsSource.bind(this);
this.autosaveFunction = this.autosaveFunction.bind(this);
this.iTimer = 0;
}

View file

@ -106,7 +106,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
}
};
this.deletePublickKey = _.bind(this.deletePublickKey, this);
this.deletePublickKey = this.deletePublickKey.bind(this);
}
@command((self) => !self.submitRequest() && (self.sign() || self.encrypt()))

View file

@ -205,7 +205,7 @@ class ContactsPopupView extends AbstractViewNext {
this.viewHash = ko.computed(() => '' + _.map(this.viewProperties(), (oItem) => oItem.value()).join(''));
// this.saveCommandDebounce = _.debounce(_.bind(this.saveCommand, this), 1000);
// this.saveCommandDebounce = _.debounce(this.saveCommand.bind(this), 1000);
this.viewHash.subscribe(() => {
if (this.watchHash() && !this.viewReadOnly() && !this.watchDirty()) {
@ -482,7 +482,7 @@ class ContactsPopupView extends AbstractViewNext {
deleteSelectedContacts() {
if (0 < this.contactsCheckedOrSelected().length) {
Remote.contactsDelete(_.bind(this.deleteResponse, this), this.contactsCheckedOrSelectedUids());
Remote.contactsDelete(this.deleteResponse.bind(this), this.contactsCheckedOrSelectedUids());
this.removeCheckedOrSelectedContactsFromList();
}

View file

@ -1,4 +1,3 @@
import _ from '_';
import ko from 'ko';
import { StorageResultType, ServerSecure, Ports, Notification } from 'Common/Enums';
@ -201,7 +200,7 @@ class DomainPopupView extends AbstractViewNext {
createOrAddCommand() {
this.saving(true);
Remote.createOrUpdateDomain(
_.bind(this.onDomainCreateOrSaveResponse, this),
this.onDomainCreateOrSaveResponse.bind(this),
!this.edit(),
this.name(),
@ -238,7 +237,7 @@ class DomainPopupView extends AbstractViewNext {
this.testing(true);
Remote.testConnectionForDomain(
_.bind(this.onTestConnectionResponse, this),
this.onTestConnectionResponse.bind(this),
this.name(),
this.imapServer(),

View file

@ -38,7 +38,7 @@ class DomainAliasPopupView extends AbstractViewNext {
this.canBeSaved = ko.computed(() => !this.saving() && '' !== this.name() && '' !== this.alias());
this.onDomainAliasCreateOrSaveResponse = _.bind(this.onDomainAliasCreateOrSaveResponse, this);
this.onDomainAliasCreateOrSaveResponse = this.onDomainAliasCreateOrSaveResponse.bind(this);
}
@command((self) => self.canBeSaved())

View file

@ -1,4 +1,3 @@
import _ from '_';
import ko from 'ko';
import { FiltersAction, FilterConditionField, FilterConditionType } from 'Common/Enums';
@ -44,7 +43,7 @@ class FilterPopupView extends AbstractViewNext {
this.typeOptions = ko.observableArray([]);
this.typeOptionsSize = ko.observableArray([]);
initOnStartOrLangChange(_.bind(this.populateOptions, this));
initOnStartOrLangChange(this.populateOptions.bind(this));
this.modules.subscribe(this.populateOptions, this);
}

View file

@ -19,7 +19,7 @@ class PluginPopupView extends AbstractViewNext {
constructor() {
super();
this.onPluginSettingsUpdateResponse = _.bind(this.onPluginSettingsUpdateResponse, this);
this.onPluginSettingsUpdateResponse = this.onPluginSettingsUpdateResponse.bind(this);
this.saveError = ko.observable('');
@ -43,7 +43,7 @@ class PluginPopupView extends AbstractViewNext {
this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = KeyState.All;
this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), Magics.Time200ms);
this.tryToClosePopup = _.debounce(this.tryToClosePopup.bind(this), Magics.Time200ms);
}
@command((self) => self.hasConfiguration())

View file

@ -1,5 +1,4 @@
import window from 'window';
import _ from '_';
import ko from 'ko';
import qr from 'qr';
@ -87,8 +86,8 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext {
this.twoFactorAllowedEnable = ko.computed(() => this.viewEnable() || this.twoFactorTested());
this.onResult = _.bind(this.onResult, this);
this.onShowSecretResult = _.bind(this.onShowSecretResult, this);
this.onResult = this.onResult.bind(this);
this.onShowSecretResult = this.onShowSecretResult.bind(this);
}
showSecret() {

View file

@ -41,7 +41,7 @@ class AbstractSystemDropDownUserView extends AbstractViewNext {
this.accountMenuDropdownTrigger = ko.observable(false);
this.capaAdditionalAccounts = ko.observable(Settings.capa(Capa.AdditionalAccounts));
this.addAccountClick = _.bind(this.addAccountClick, this);
this.addAccountClick = this.addAccountClick.bind(this);
Events.sub('audio.stop', () => AppStore.currentAudio(''));
Events.sub('audio.start', (name) => AppStore.currentAudio(name));

View file

@ -222,7 +222,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
this.canBeMoved = this.hasCheckedOrSelectedLines;
this.quotaTooltip = _.bind(this.quotaTooltip, this);
this.quotaTooltip = this.quotaTooltip.bind(this);
this.selector = new Selector(
this.messageList,

View file

@ -338,7 +338,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
this.toggleFullScreen();
});
this.attachmentPreview = _.bind(this.attachmentPreview, this);
this.attachmentPreview = this.attachmentPreview.bind(this);
}
@command()
@ -529,7 +529,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
onBuild(dom) {
const self = this,
fCheckHeaderHeight = _.bind(this.checkHeaderHeight, this);
fCheckHeaderHeight = this.checkHeaderHeight.bind(this);
this.oDom = dom;
@ -685,7 +685,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
initShortcuts() {
// exit fullscreen, back
key('esc, backspace', KeyState.MessageView, _.bind(this.escShortcuts, this));
key('esc, backspace', KeyState.MessageView, this.escShortcuts.bind(this));
// fullscreen
key('enter', KeyState.MessageView, () => {