How can I send a message from BGSW to content script and back?

The messaging documentation hardly touches on this issue, the only thing I managed to find is that I need to use ports to send messages, however, the example shown in the ports part only indicates how to transfer a message from BGSW to a popup page. This is an incredibly frustrating experience. Basically at the last stage of extension development, a problem arises for which there is practically no material and answers. My task When the user clicks on one of the actions in the context menu, image processing begins, after processing it is necessary to save it to a file or copy it to the clipboard. The image is processed in the background.ts, I want to send a request to copy the image to the content script because I need access to the DOM.
No description
1 Reply
Arcane
Arcane•10mo ago
Answer Overflow#5052
User Info
ID: 958907348389339146 Name: Answer Overflow#5052
Joined Discord
<t:1648691727:F> (<t:1648691727:R>)
Joined server
<t:1684607276:F> (<t:1684607276:R>)
Roles
<@&948842481057939456>, <@&1109548077334941721>
Want results from more Discord servers?
Add your server