From 97a6cedbcd1a6e791b55b612086eb8d30ed1ca1f Mon Sep 17 00:00:00 2001 From: praschke Date: Sun, 1 Oct 2023 09:08:49 +0100 Subject: remove yomichan.connect() it was only used in the cross-frame api. additionally, this comment on triggerExtensionUnloaded is incorrect. --- ext/js/yomichan.js | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'ext/js/yomichan.js') diff --git a/ext/js/yomichan.js b/ext/js/yomichan.js index 6eea952e..e4fcd4bc 100644 --- a/ext/js/yomichan.js +++ b/ext/js/yomichan.js @@ -172,24 +172,6 @@ class Yomichan extends EventDispatcher { } } - /** - * Runs `chrome.runtime.connect()` with additional exception handling events. - * @param {...*} args The arguments to be passed to `chrome.runtime.connect()`. - * @returns {Port} The resulting port. - * @throws {Error} Errors thrown by `chrome.runtime.connect()` are re-thrown. - */ - connect(...args) { - try { - return chrome.runtime.connect(...args); - } catch (e) { - this.triggerExtensionUnloaded(); - throw e; - } - } - - /** - * Runs chrome.runtime.connect() with additional exception handling events. - */ triggerExtensionUnloaded() { this._isExtensionUnloaded = true; if (this._isTriggeringExtensionUnloaded) { return; } -- cgit v1.2.3 From 841d49c7f97678b4873ea198b91419687d137849 Mon Sep 17 00:00:00 2001 From: praschke Date: Sun, 1 Oct 2023 09:47:59 +0100 Subject: wait for backend ready signal to prepare cross-frame api not sure if API messages should be sent in prepare(), but we should probably wait for the ready signal before doing so --- ext/js/yomichan.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ext/js/yomichan.js') diff --git a/ext/js/yomichan.js b/ext/js/yomichan.js index e4fcd4bc..5a55b3ea 100644 --- a/ext/js/yomichan.js +++ b/ext/js/yomichan.js @@ -129,12 +129,12 @@ class Yomichan extends EventDispatcher { if (!isBackground) { this._api = new API(this); - this._crossFrame = new CrossFrameAPI(); - this._crossFrame.prepare(); - this.sendMessage({action: 'requestBackendReadySignal'}); await this._isBackendReadyPromise; + this._crossFrame = new CrossFrameAPI(); + await this._crossFrame.prepare(); + log.on('log', this._onForwardLog.bind(this)); } } -- cgit v1.2.3