From f725549330e851ededad3c97c4517f8a23168e4a Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 23 Dec 2019 14:09:41 -0500 Subject: Remove redundant window resize handler --- ext/fg/js/frontend.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'ext/fg/js') diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index 2543b52c..85f1f373 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -42,6 +42,8 @@ class Frontend extends TextScanner { try { await this.updateOptions(); + window.addEventListener('resize', this.onResize.bind(this), false); + yomichan.on('orphaned', () => this.onOrphaned()); yomichan.on('optionsUpdate', () => this.updateOptions()); chrome.runtime.onMessage.addListener(this.onRuntimeMessage.bind(this)); @@ -51,7 +53,7 @@ class Frontend extends TextScanner { } async onResize() { - const textSource = this.textSourceCurrent; + const textSource = this.getCurrentTextSource(); if (textSource !== null && await this.popup.isVisible()) { this._showPopupContent(textSource); } @@ -81,8 +83,7 @@ class Frontend extends TextScanner { getMouseEventListeners() { return [ ...super.getMouseEventListeners(), - [window, 'message', this.onWindowMessage.bind(this)], - [window, 'resize', this.onResize.bind(this)] + [window, 'message', this.onWindowMessage.bind(this)] ]; } -- cgit v1.2.3