From 275f455e73c48294aeefd6c02959b1ddd3cbf4e8 Mon Sep 17 00:00:00 2001 From: siikamiika Date: Fri, 10 Apr 2020 16:06:22 +0300 Subject: [PATCH] fix preview frame error --- ext/fg/js/frontend.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index f969df32..cd811115 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -26,7 +26,7 @@ */ class Frontend extends TextScanner { - constructor(popup, initEventDispatcher) { + constructor(popup, initEventDispatcher=null) { super( window, () => this.popup.isProxy() ? [] : [this.popup.getContainer()], @@ -77,8 +77,10 @@ class Frontend extends TextScanner { window.visualViewport.addEventListener('resize', this.onVisualViewportResize.bind(this)); } - this.initEventDispatcher.on('setDisabledOverride', this.onSetDisabledOverride.bind(this)); - this.initEventDispatcher.on('popupChange', this.onPopupChange.bind(this)); + if (this.initEventDispatcher !== null) { + this.initEventDispatcher.on('setDisabledOverride', this.onSetDisabledOverride.bind(this)); + this.initEventDispatcher.on('popupChange', this.onPopupChange.bind(this)); + } yomichan.on('orphaned', this.onOrphaned.bind(this)); yomichan.on('optionsUpdated', this.updateOptions.bind(this));