How to send messages from content to content?

I am building an extension which injects multiple content script UIs in a single page (in order to have different mount points) and I am looking for a way to get them to pass messages efficiently. I managed to do it via the messaging API, but that takes 5ms on average and isn't exactly snappy. Apparently the chrome.tabs API isn't available to content scripts for some reason, and as far as I can tell you can't use the chrome.runtime API to send directly between content scripts because although the extension message infrastructure works as a broadcast, the source that sends the message will not also receive it. I mean all content scripts share the same runtime ID so it'd be crazy if there's no way to get content scripts to talk to each other directly. Any clues will be highly appreciated.
1 Reply
tatsumaru
tatsumaruOP•5w ago
I've also tried to use a parent-child pattern, but since plasmo automatically mounts all .svelte files it ends up mounting both the parent and children components which makes a mess. Is there no way to bypass the auto-mounting in plasmo other than to use vanilla js/ts?
Want results from more Discord servers?
Add your server