From 8bc1a409144898124386ef03e921efb2a6e73a8f Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Wed, 26 Feb 2020 21:01:40 -0500 Subject: Use .bind instead of () => {} --- ext/fg/js/float.js | 4 ++-- ext/fg/js/frontend.js | 6 +++--- ext/fg/js/popup.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'ext/fg') diff --git a/ext/fg/js/float.js b/ext/fg/js/float.js index 7cc9c367..aef0367e 100644 --- a/ext/fg/js/float.js +++ b/ext/fg/js/float.js @@ -51,8 +51,8 @@ class DisplayFloat extends Display { ['setContentScale', ({scale}) => this.setContentScale(scale)] ]); - yomichan.on('orphaned', () => this.onOrphaned()); - window.addEventListener('message', (e) => this.onMessage(e), false); + yomichan.on('orphaned', this.onOrphaned.bind(this)); + window.addEventListener('message', this.onMessage.bind(this), false); } async prepare(options, popupInfo, url, childrenSupported, scale, uniqueId) { diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index 71ca7c9e..929ab56a 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -64,9 +64,9 @@ class Frontend extends TextScanner { window.visualViewport.addEventListener('resize', this.onVisualViewportResize.bind(this)); } - yomichan.on('orphaned', () => this.onOrphaned()); - yomichan.on('optionsUpdated', () => this.updateOptions()); - yomichan.on('zoomChanged', (e) => this.onZoomChanged(e)); + yomichan.on('orphaned', this.onOrphaned.bind(this)); + yomichan.on('optionsUpdated', this.updateOptions.bind(this)); + yomichan.on('zoomChanged', this.onZoomChanged.bind(this)); chrome.runtime.onMessage.addListener(this.onRuntimeMessage.bind(this)); this._updateContentScale(); diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index 4927f4bd..bc40a8c4 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -260,7 +260,7 @@ class Popup { 'mozfullscreenchange', 'webkitfullscreenchange' ]; - const onFullscreenChanged = () => this._onFullscreenChanged(); + const onFullscreenChanged = this._onFullscreenChanged.bind(this); for (const eventName of fullscreenEvents) { this._fullscreenEventListeners.addEventListener(document, eventName, onFullscreenChanged, false); } -- cgit v1.2.3