summaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/backend.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index faba6c42..0c7a0301 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -168,6 +168,8 @@ class Backend {
}, 1000);
this._updateBadge();
+ yomichan.on('log', this._onLog.bind(this));
+
await this.environment.prepare();
await this.database.prepare();
await this.translator.prepare();
@@ -316,6 +318,14 @@ class Backend {
chrome.tabs.sendMessage(tabId, {action: 'zoomChanged', params: {oldZoomFactor, newZoomFactor}}, callback);
}
+ _onLog({level}) {
+ const levelValue = this._getErrorLevelValue(level);
+ if (levelValue <= this._getErrorLevelValue(this._logErrorLevel)) { return; }
+
+ this._logErrorLevel = level;
+ this._updateBadge();
+ }
+
applyOptions() {
const options = this.getOptions(this.optionsContext);
this._updateBadge();
@@ -809,12 +819,6 @@ class Backend {
_onApiLog({error, level, context}) {
yomichan.log(jsonToError(error), level, context);
-
- const levelValue = this._getErrorLevelValue(level);
- if (levelValue <= this._getErrorLevelValue(this._logErrorLevel)) { return; }
-
- this._logErrorLevel = level;
- this._updateBadge();
}
_onApiLogIndicatorClear() {