aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-03-02 10:35:46 +0200
committersiikamiika <siikamiika@users.noreply.github.com>2020-03-02 10:35:46 +0200
commitbd48d2f919e1387063c66ef91c40ec86a1131118 (patch)
tree8116d3efa3199d6664592c86d8530548113a01cb
parent967e99b7f69d24fc76999675cef44b919602dd31 (diff)
fix Yomichan core message issues
-rw-r--r--ext/bg/js/backend.js4
-rw-r--r--ext/mixed/js/core.js2
-rw-r--r--test/test-database.js3
3 files changed, 6 insertions, 3 deletions
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index 81578462..cdcfb7ad 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -48,7 +48,7 @@ class Backend {
this.messageToken = yomichan.generateId(16);
this._messageHandlers = new Map([
- ['yomichanOnline', this._onApiYomichanOnline.bind(this)],
+ ['yomichanCoreReady', this._onApiYomichanCoreReady.bind(this)],
['optionsSchemaGet', this._onApiOptionsSchemaGet.bind(this)],
['optionsGet', this._onApiOptionsGet.bind(this)],
['optionsGetFull', this._onApiOptionsGetFull.bind(this)],
@@ -273,7 +273,7 @@ class Backend {
// Message handlers
- async _onApiYomichanOnline(_params, sender) {
+ async _onApiYomichanCoreReady(_params, sender) {
const tabId = sender.tab.id;
return new Promise((resolve) => {
chrome.tabs.sendMessage(tabId, {action: 'backendPrepared'}, resolve);
diff --git a/ext/mixed/js/core.js b/ext/mixed/js/core.js
index a3cb2459..b7ac8743 100644
--- a/ext/mixed/js/core.js
+++ b/ext/mixed/js/core.js
@@ -280,7 +280,7 @@ const yomichan = (() => {
]);
chrome.runtime.onMessage.addListener(this._onMessage.bind(this));
- chrome.runtime.sendMessage({action: 'yomichanOnline'});
+ chrome.runtime.sendMessage({action: 'yomichanCoreReady'});
}
// Public
diff --git a/test/test-database.js b/test/test-database.js
index 35f22523..9a24a393 100644
--- a/test/test-database.js
+++ b/test/test-database.js
@@ -30,6 +30,9 @@ const chrome = {
},
getURL(path2) {
return url.pathToFileURL(path.join(__dirname, '..', 'ext', path2.replace(/^\//, '')));
+ },
+ sendMessage() {
+ // NOP
}
}
};