Error with messaging
Hey, im trying to send a message from a content script in the main world to the background.
For that I have 2 small scripts, that I copied mainly from the docs, but I still cant get it to work. Why?
/src/background/messages/ping.ts
/src/contents/componentInRealWorld.ts
2 Replies
Were you able to solve this?
I had to use a relay to cross the MAIN world boundary. I have a file
src/background/messages/tabApi.ts
. I have a content script named main-world-handler
that registers all the relays. In that file I have
I can then call it from a MAIN world script with
await sendToBackgroundViaRelay({name: 'tabAPI', body: {...}})