dev.....!

This commit is contained in:
Gabe Yuan
2023-08-31 13:38:06 +08:00
parent aa795e2731
commit 4486ad353c
15 changed files with 50 additions and 41 deletions

View File

@@ -6,8 +6,8 @@ import { browser } from "./browser";
* @param {*} args
* @returns
*/
export const sendMsg = (action, args) =>
browser?.runtime?.sendMessage({ action, args });
export const sendBgMsg = (action, args) =>
browser.runtime.sendMessage({ action, args });
/**
* 发送消息给当前页面
@@ -16,6 +16,6 @@ export const sendMsg = (action, args) =>
* @returns
*/
export const sendTabMsg = async (action, args) => {
const tabs = await browser?.tabs.query({ active: true, currentWindow: true });
return await browser?.tabs.sendMessage(tabs[0].id, { action, args });
const tabs = await browser.tabs.query({ active: true, currentWindow: true });
return browser.tabs.sendMessage(tabs[0].id, { action, args });
};