fix Yomichan core message issues
This commit is contained in:
parent
967e99b7f6
commit
bd48d2f919
@ -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);
|
||||
|
@ -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
|
||||
|
@ -30,6 +30,9 @@ const chrome = {
|
||||
},
|
||||
getURL(path2) {
|
||||
return url.pathToFileURL(path.join(__dirname, '..', 'ext', path2.replace(/^\//, '')));
|
||||
},
|
||||
sendMessage() {
|
||||
// NOP
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user