mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-09-04 20:24:12 +08:00
_.bind(function, object) to function.bind(object)
This commit is contained in:
parent
db2d95d684
commit
af136f46c4
23 changed files with 38 additions and 45 deletions
|
@ -131,7 +131,7 @@ class AppUser extends AbstractApp {
|
|||
this.moveCache = {};
|
||||
|
||||
this.quotaDebounce = _.debounce(this.quota, Magics.Time30s);
|
||||
this.moveOrDeleteResponseHelper = _.bind(this.moveOrDeleteResponseHelper, this);
|
||||
this.moveOrDeleteResponseHelper = this.moveOrDeleteResponseHelper.bind(this);
|
||||
|
||||
this.messagesMoveTrigger = _.debounce(this.messagesMoveTrigger, 500);
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class HtmlEditor {
|
|||
this.element = element;
|
||||
this.$element = $(element);
|
||||
|
||||
this.resize = _.throttle(_.bind(this.resizeEditor, this), 100);
|
||||
this.resize = _.throttle(this.resizeEditor.bind(this), 100);
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ class Selector {
|
|||
this.focusedItem = koFocusedItem || ko.observable(null);
|
||||
this.selectedItem = koSelectedItem || ko.observable(null);
|
||||
|
||||
this.itemSelectedThrottle = _.debounce(_.bind(this.itemSelected, this), 300);
|
||||
this.itemSelectedThrottle = _.debounce(this.itemSelected.bind(this), 300);
|
||||
|
||||
this.listChecked.subscribe((items) => {
|
||||
if (0 < items.length) {
|
||||
|
|
|
@ -16,12 +16,11 @@ const isFunc = _.isFunction;
|
|||
const isUnd = _.isUndefined;
|
||||
const isNull = _.isNull;
|
||||
const has = _.has;
|
||||
const bind = _.bind;
|
||||
const noop = () => {}; // eslint-disable-line no-empty-function
|
||||
const noopTrue = () => true;
|
||||
const noopFalse = () => false;
|
||||
|
||||
export { trim, isArray, isObject, isFunc, isUnd, isNull, has, bind, noop, noopTrue, noopFalse, jassl };
|
||||
export { trim, isArray, isObject, isFunc, isUnd, isNull, has, noop, noopTrue, noopFalse, jassl };
|
||||
|
||||
/**
|
||||
* @param {Function} func
|
||||
|
|
|
@ -24,7 +24,7 @@ class AbstractRadio extends AbstractComponent {
|
|||
this.values(_.map(params.values, (label, value) => ({ label: label, value: value })));
|
||||
}
|
||||
|
||||
this.click = _.bind(this.click, this);
|
||||
this.click = this.click.bind(this);
|
||||
}
|
||||
|
||||
click(value) {
|
||||
|
|
|
@ -13,8 +13,8 @@ class CheckboxMaterialDesignComponent extends AbstractCheckbox {
|
|||
this.animationBox = ko.observable(false).extend({ falseTimeout: 200 });
|
||||
this.animationCheckmark = ko.observable(false).extend({ falseTimeout: 200 });
|
||||
|
||||
this.animationBoxSetTrue = _.bind(this.animationBoxSetTrue, this);
|
||||
this.animationCheckmarkSetTrue = _.bind(this.animationCheckmarkSetTrue, this);
|
||||
this.animationBoxSetTrue = this.animationBoxSetTrue.bind(this);
|
||||
this.animationCheckmarkSetTrue = this.animationCheckmarkSetTrue.bind(this);
|
||||
|
||||
this.disposable.push(
|
||||
this.value.subscribe((value) => {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import _ from '_';
|
||||
import crossroads from 'crossroads';
|
||||
import { isArray, isNonEmptyArray, noop } from 'Common/Utils';
|
||||
|
||||
|
@ -49,7 +48,7 @@ export class AbstractScreen {
|
|||
const routes = this.routes();
|
||||
|
||||
if (isNonEmptyArray(routes)) {
|
||||
fMatcher = _.bind(this.onRoute || noop, this);
|
||||
fMatcher = (this.onRoute || noop).bind(this);
|
||||
route = crossroads.create();
|
||||
|
||||
routes.forEach((item) => {
|
||||
|
|
|
@ -100,7 +100,7 @@ class ContactsAdminSettings {
|
|||
|
||||
this.contactsType(settingsGet('ContactsPdoType'));
|
||||
|
||||
this.onTestContactsResponse = _.bind(this.onTestContactsResponse, this);
|
||||
this.onTestContactsResponse = this.onTestContactsResponse.bind(this);
|
||||
}
|
||||
|
||||
@command((self) => '' !== self.pdoDsn() && '' !== self.pdoUser())
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import { StorageResultType } from 'Common/Enums';
|
||||
|
@ -17,8 +16,8 @@ class DomainsAdminSettings {
|
|||
|
||||
this.domainForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
|
||||
this.onDomainListChangeRequest = _.bind(this.onDomainListChangeRequest, this);
|
||||
this.onDomainLoadRequest = _.bind(this.onDomainLoadRequest, this);
|
||||
this.onDomainListChangeRequest = this.onDomainListChangeRequest.bind(this);
|
||||
this.onDomainLoadRequest = this.onDomainLoadRequest.bind(this);
|
||||
}
|
||||
|
||||
createDomain() {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import { StorageResultType, Notification } from 'Common/Enums';
|
||||
|
@ -26,8 +25,8 @@ class PluginsAdminSettings {
|
|||
|
||||
this.visibility = ko.computed(() => (PluginStore.plugins.loading() ? 'visible' : 'hidden'));
|
||||
|
||||
this.onPluginLoadRequest = _.bind(this.onPluginLoadRequest, this);
|
||||
this.onPluginDisableRequest = _.bind(this.onPluginDisableRequest, this);
|
||||
this.onPluginLoadRequest = this.onPluginLoadRequest.bind(this);
|
||||
this.onPluginDisableRequest = this.onPluginDisableRequest.bind(this);
|
||||
}
|
||||
|
||||
disablePlugin(plugin) {
|
||||
|
|
|
@ -74,7 +74,7 @@ class SecurityAdminSettings {
|
|||
this.adminPasswordNewError(false);
|
||||
});
|
||||
|
||||
this.onNewAdminPasswordResponse = _.bind(this.onNewAdminPasswordResponse, this);
|
||||
this.onNewAdminPasswordResponse = this.onNewAdminPasswordResponse.bind(this);
|
||||
}
|
||||
|
||||
@command((self) => '' !== trim(self.adminLogin()) && '' !== self.adminPassword())
|
||||
|
|
|
@ -100,7 +100,7 @@ class MessageUserStore {
|
|||
this.computers();
|
||||
this.subscribers();
|
||||
|
||||
this.onMessageResponse = _.bind(this.onMessageResponse, this);
|
||||
this.onMessageResponse = this.onMessageResponse.bind(this);
|
||||
|
||||
this.purgeMessageBodyCacheThrottle = _.throttle(this.purgeMessageBodyCache, Magics.Time30s);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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()))
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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, () => {
|
||||
|
|
Loading…
Add table
Reference in a new issue