diff options
Diffstat (limited to 'ext/mixed')
-rw-r--r-- | ext/mixed/js/api.js | 2 | ||||
-rw-r--r-- | ext/mixed/js/core.js | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/ext/mixed/js/api.js b/ext/mixed/js/api.js index ae74b8dc..18b360a3 100644 --- a/ext/mixed/js/api.js +++ b/ext/mixed/js/api.js @@ -115,8 +115,8 @@ function _apiInvoke(action, params={}) { } }); } catch (e) { - window.yomichan_orphaned = true; reject(e); + yomichan.triggerOrphaned(e); } }); } diff --git a/ext/mixed/js/core.js b/ext/mixed/js/core.js index a3c8c0b0..5e560a58 100644 --- a/ext/mixed/js/core.js +++ b/ext/mixed/js/core.js @@ -244,6 +244,14 @@ const yomichan = (() => { chrome.runtime.onMessage.addListener(this._onMessage.bind(this)); } + // Public + + triggerOrphaned(error) { + this.trigger('orphaned', {error}); + } + + // Private + _onMessage({action, params}, sender, callback) { const handler = this._messageHandlers.get(action); if (typeof handler !== 'function') { return false; } |