diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2024-01-20 23:13:17 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-21 04:13:17 +0000 |
commit | 6ba1ffe74558dd174e3308d48885fb068fa37d55 (patch) | |
tree | 5519bbf972096e0e3370171d2b62a26d6164d671 /ext/js/app | |
parent | ebdde1ee612a262256ad0384131e53bc29b1e10f (diff) |
WebExtension class (#551)
* Add WebExtension class
* Use WebExtension class
* Use WebExtension instance for all runtime message sending
* Use getUrl
* Add a sendMessage variant which ignores the response and error
Diffstat (limited to 'ext/js/app')
-rw-r--r-- | ext/js/app/frontend.js | 8 | ||||
-rw-r--r-- | ext/js/app/popup-proxy.js | 2 | ||||
-rw-r--r-- | ext/js/app/popup-window.js | 4 | ||||
-rw-r--r-- | ext/js/app/popup.js | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/ext/js/app/frontend.js b/ext/js/app/frontend.js index 13d2d9d8..837364ad 100644 --- a/ext/js/app/frontend.js +++ b/ext/js/app/frontend.js @@ -226,7 +226,7 @@ export class Frontend { try { await this._updateOptionsInternal(); } catch (e) { - if (!yomitan.isExtensionUnloaded) { + if (!yomitan.webExtension.unloaded) { throw e; } } @@ -368,7 +368,7 @@ export class Frontend { const scanningOptions = /** @type {import('settings').ProfileOptions} */ (this._options).scanning; if (error !== null) { - if (yomitan.isExtensionUnloaded) { + if (yomitan.webExtension.unloaded) { if (textSource !== null && !passive) { this._showExtensionUnloaded(textSource); } @@ -655,7 +655,7 @@ export class Frontend { try { return this._popup !== null && await this._popup.containsPoint(x, y); } catch (e) { - if (!yomitan.isExtensionUnloaded) { + if (!yomitan.webExtension.unloaded) { throw e; } return false; @@ -742,7 +742,7 @@ export class Frontend { Promise.resolve() ); this._lastShowPromise.catch((error) => { - if (yomitan.isExtensionUnloaded) { return; } + if (yomitan.webExtension.unloaded) { return; } log.error(error); }); return this._lastShowPromise; diff --git a/ext/js/app/popup-proxy.js b/ext/js/app/popup-proxy.js index fa4a448b..856ec086 100644 --- a/ext/js/app/popup-proxy.js +++ b/ext/js/app/popup-proxy.js @@ -320,7 +320,7 @@ export class PopupProxy extends EventDispatcher { try { return await this._invoke(action, params); } catch (e) { - if (!yomitan.isExtensionUnloaded) { throw e; } + if (!yomitan.webExtension.unloaded) { throw e; } return defaultReturnValue; } } diff --git a/ext/js/app/popup-window.js b/ext/js/app/popup-window.js index 60d99612..7a0b6af4 100644 --- a/ext/js/app/popup-window.js +++ b/ext/js/app/popup-window.js @@ -274,7 +274,7 @@ export class PopupWindow extends EventDispatcher { * @returns {Promise<import('display').DirectApiReturn<TName>|undefined>} */ async _invoke(open, action, params) { - if (yomitan.isExtensionUnloaded) { + if (yomitan.webExtension.unloaded) { return void 0; } @@ -290,7 +290,7 @@ export class PopupWindow extends EventDispatcher { message )); } catch (e) { - if (yomitan.isExtensionUnloaded) { + if (yomitan.webExtension.unloaded) { open = false; } } diff --git a/ext/js/app/popup.js b/ext/js/app/popup.js index 0a84f3f7..c741e8f1 100644 --- a/ext/js/app/popup.js +++ b/ext/js/app/popup.js @@ -714,7 +714,7 @@ export class Popup extends EventDispatcher { try { return await this._invoke(action, params); } catch (e) { - if (!yomitan.isExtensionUnloaded) { throw e; } + if (!yomitan.webExtension.unloaded) { throw e; } return void 0; } } |