Closed mttzzz closed 1 year ago
In your content-script
import { sendMessage } from "webext-bridge/content-script";
const res = await sendMessage(
"get-data",
{},
"background"
);
console.log(res) // anything
and in your background
:
import { onMessage } from "webext-bridge/background";
onMessage("get-data", ({ data }) => {
return 'anything';
});
More usage details here: https://github.com/zikaari/webext-bridge#example
popup => background background => popup content-script => popup, background
Maybe need some magic?
i use examples from documentation webext-bridge.