aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js/display.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-07-18 14:15:36 -0400
committerGitHub <noreply@github.com>2020-07-18 14:15:36 -0400
commitdac33e696145ad3c2cfe076a7fadc82c05732102 (patch)
tree06dff8bd7dd2d8ebad5a025cf71e2910b2af80d4 /ext/mixed/js/display.js
parentf9c76efea00ff62021119c4d0fcf414e8988be1d (diff)
Extension unload indication fix (#662)
* Remove unused function * Rename field * Change extensionUnloaded trigger function * Update how extension unloaded content is shown * Ignore certain errors caused by extension unload * Add _showExtensionUnloaded function * Wrap internals of updateOptions * Suppress errors caued by extension unload * Make the frontend trigger the popup's extensionUnloaded event
Diffstat (limited to 'ext/mixed/js/display.js')
-rw-r--r--ext/mixed/js/display.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 7dc63e65..bf3e3eae 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -97,14 +97,12 @@ class Display {
this._setInteractive(true);
await yomichan.ready();
await this._displayGenerator.prepare();
+ yomichan.on('extensionUnloaded', this._onExtensionUnloaded.bind(this));
}
onError(error) {
- if (yomichan.isExtensionUnloaded) {
- this.setContent('extensionUnloaded');
- } else {
- yomichan.logError(error);
- }
+ if (yomichan.isExtensionUnloaded) { return; }
+ yomichan.logError(error);
}
onEscape() {
@@ -176,9 +174,6 @@ class Display {
case 'kanji':
await this._setContentKanji(details.definitions, details.context, token);
break;
- case 'extensionUnloaded':
- this._setContentExtensionUnloaded();
- break;
}
} catch (e) {
this.onError(e);
@@ -236,6 +231,10 @@ class Display {
// Private
+ _onExtensionUnloaded() {
+ this._setContentExtensionUnloaded();
+ }
+
_onSourceTermView(e) {
e.preventDefault();
this._sourceTermView();