diff --git a/dev/App/User.js b/dev/App/User.js index 103a8fbde..f48a2dd6c 100644 --- a/dev/App/User.js +++ b/dev/App/User.js @@ -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); diff --git a/dev/Common/HtmlEditor.js b/dev/Common/HtmlEditor.js index b8efb3d48..904702aea 100644 --- a/dev/Common/HtmlEditor.js +++ b/dev/Common/HtmlEditor.js @@ -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(); } diff --git a/dev/Common/Selector.js b/dev/Common/Selector.js index 35f17f812..a1581fd6f 100644 --- a/dev/Common/Selector.js +++ b/dev/Common/Selector.js @@ -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) { diff --git a/dev/Common/Utils.js b/dev/Common/Utils.js index c8a4eeec4..10541c501 100644 --- a/dev/Common/Utils.js +++ b/dev/Common/Utils.js @@ -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 diff --git a/dev/Component/AbstractRadio.js b/dev/Component/AbstractRadio.js index 824618ed3..bb1bfeb69 100644 --- a/dev/Component/AbstractRadio.js +++ b/dev/Component/AbstractRadio.js @@ -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) { diff --git a/dev/Component/MaterialDesign/Checkbox.js b/dev/Component/MaterialDesign/Checkbox.js index c8de209a5..6df5ebb32 100644 --- a/dev/Component/MaterialDesign/Checkbox.js +++ b/dev/Component/MaterialDesign/Checkbox.js @@ -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) => { diff --git a/dev/Knoin/AbstractScreen.js b/dev/Knoin/AbstractScreen.js index 500690426..7de0d3686 100644 --- a/dev/Knoin/AbstractScreen.js +++ b/dev/Knoin/AbstractScreen.js @@ -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) => { diff --git a/dev/Settings/Admin/Contacts.js b/dev/Settings/Admin/Contacts.js index 15603645c..16812f1cd 100644 --- a/dev/Settings/Admin/Contacts.js +++ b/dev/Settings/Admin/Contacts.js @@ -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()) diff --git a/dev/Settings/Admin/Domains.js b/dev/Settings/Admin/Domains.js index 782a0b68d..a175d1a58 100644 --- a/dev/Settings/Admin/Domains.js +++ b/dev/Settings/Admin/Domains.js @@ -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() { diff --git a/dev/Settings/Admin/Plugins.js b/dev/Settings/Admin/Plugins.js index 2729be672..f71145de5 100644 --- a/dev/Settings/Admin/Plugins.js +++ b/dev/Settings/Admin/Plugins.js @@ -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) { diff --git a/dev/Settings/Admin/Security.js b/dev/Settings/Admin/Security.js index 91bc803cd..8fde2bf76 100644 --- a/dev/Settings/Admin/Security.js +++ b/dev/Settings/Admin/Security.js @@ -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()) diff --git a/dev/Stores/User/Message.js b/dev/Stores/User/Message.js index 7f274d9a3..fcc8fa075 100644 --- a/dev/Stores/User/Message.js +++ b/dev/Stores/User/Message.js @@ -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); } diff --git a/dev/View/Popup/Compose.js b/dev/View/Popup/Compose.js index 499fd8939..20e8a9a8a 100644 --- a/dev/View/Popup/Compose.js +++ b/dev/View/Popup/Compose.js @@ -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; } diff --git a/dev/View/Popup/ComposeOpenPgp.js b/dev/View/Popup/ComposeOpenPgp.js index 99cbe529a..e9cfc3002 100644 --- a/dev/View/Popup/ComposeOpenPgp.js +++ b/dev/View/Popup/ComposeOpenPgp.js @@ -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())) diff --git a/dev/View/Popup/Contacts.js b/dev/View/Popup/Contacts.js index 58f1a9534..2c85b4cc0 100644 --- a/dev/View/Popup/Contacts.js +++ b/dev/View/Popup/Contacts.js @@ -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(); } diff --git a/dev/View/Popup/Domain.js b/dev/View/Popup/Domain.js index 58018dcb8..09cde5976 100644 --- a/dev/View/Popup/Domain.js +++ b/dev/View/Popup/Domain.js @@ -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(), diff --git a/dev/View/Popup/DomainAlias.js b/dev/View/Popup/DomainAlias.js index d0f03960d..ed4c3e1a4 100644 --- a/dev/View/Popup/DomainAlias.js +++ b/dev/View/Popup/DomainAlias.js @@ -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()) diff --git a/dev/View/Popup/Filter.js b/dev/View/Popup/Filter.js index 42c1c4d15..8e9f933f3 100644 --- a/dev/View/Popup/Filter.js +++ b/dev/View/Popup/Filter.js @@ -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); } diff --git a/dev/View/Popup/Plugin.js b/dev/View/Popup/Plugin.js index c8a47cef1..d5bcb5b3a 100644 --- a/dev/View/Popup/Plugin.js +++ b/dev/View/Popup/Plugin.js @@ -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()) diff --git a/dev/View/Popup/TwoFactorConfiguration.js b/dev/View/Popup/TwoFactorConfiguration.js index 283e131be..33a3cbc16 100644 --- a/dev/View/Popup/TwoFactorConfiguration.js +++ b/dev/View/Popup/TwoFactorConfiguration.js @@ -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() { diff --git a/dev/View/User/AbstractSystemDropDown.js b/dev/View/User/AbstractSystemDropDown.js index 59efb68a5..b8c50e5b4 100644 --- a/dev/View/User/AbstractSystemDropDown.js +++ b/dev/View/User/AbstractSystemDropDown.js @@ -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)); diff --git a/dev/View/User/MailBox/MessageList.js b/dev/View/User/MailBox/MessageList.js index cf0e3b3d3..d53ee3f99 100644 --- a/dev/View/User/MailBox/MessageList.js +++ b/dev/View/User/MailBox/MessageList.js @@ -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, diff --git a/dev/View/User/MailBox/MessageView.js b/dev/View/User/MailBox/MessageView.js index aa16970c6..3ba50366f 100644 --- a/dev/View/User/MailBox/MessageView.js +++ b/dev/View/User/MailBox/MessageView.js @@ -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, () => {