Update the badge icon if the backend experiences an error (#602)
This commit is contained in:
parent
8bc15e60b5
commit
5cba421201
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user