prepare Backend for browser_action
This commit is contained in:
parent
a05a05c4f4
commit
e6347a94e7
@ -278,6 +278,11 @@ class Backend {
|
|||||||
// Message handlers
|
// Message handlers
|
||||||
|
|
||||||
async _onApiYomichanCoreReady(_params, sender) {
|
async _onApiYomichanCoreReady(_params, sender) {
|
||||||
|
// tab ID isn't set in background (e.g. browser_action)
|
||||||
|
if (typeof sender.tab === 'undefined') {
|
||||||
|
return chrome.runtime.sendMessage({action: 'backendPrepared'});
|
||||||
|
}
|
||||||
|
|
||||||
const tabId = sender.tab.id;
|
const tabId = sender.tab.id;
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
chrome.tabs.sendMessage(tabId, {action: 'backendPrepared'}, resolve);
|
chrome.tabs.sendMessage(tabId, {action: 'backendPrepared'}, resolve);
|
||||||
|
@ -48,7 +48,9 @@ function setupButtonEvents(selector, command, url) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', () => {
|
window.addEventListener('DOMContentLoaded', async () => {
|
||||||
|
await yomichan.prepare();
|
||||||
|
|
||||||
showExtensionInfo();
|
showExtensionInfo();
|
||||||
|
|
||||||
apiGetEnvironmentInfo().then(({browser}) => {
|
apiGetEnvironmentInfo().then(({browser}) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user