Speed ​​up the display of the popup toggle button

This commit is contained in:
sienori 2019-05-03 05:24:45 +09:00
parent 9dccb8e20c
commit 2ba4014138

View file

@ -12,14 +12,14 @@ import "../styles/PopupPage.scss";
const getTabInfo = async () => { const getTabInfo = async () => {
try { try {
const tab = (await browser.tabs.query({ currentWindow: true, active: true }))[0]; const tab = (await browser.tabs.query({ currentWindow: true, active: true }))[0];
const tabUrl = await browser.tabs.sendMessage(tab.id, { message: "getTabUrl" }); const tabUrl = browser.tabs.sendMessage(tab.id, { message: "getTabUrl" });
const selectedText = await browser.tabs.sendMessage(tab.id, { message: "getSelectedText" }); const selectedText = browser.tabs.sendMessage(tab.id, { message: "getSelectedText" });
const isEnabledOnPage = await browser.tabs.sendMessage(tab.id, { message: "getEnabled" }); const isEnabledOnPage = browser.tabs.sendMessage(tab.id, { message: "getEnabled" });
return { return {
isConnected: true, isConnected: true,
url: tabUrl, url: await tabUrl,
selectedText: selectedText, selectedText: await selectedText,
isEnabledOnPage: isEnabledOnPage isEnabledOnPage: await isEnabledOnPage
}; };
} catch (e) { } catch (e) {
return { isConnected: false, url: "", selectedText: "", isEnabledOnPage: false }; return { isConnected: false, url: "", selectedText: "", isEnabledOnPage: false };