nayrbhpdf5D
nayrbhpdf5D
PD🧩 Plasmo Developers
Created by nayrbhpdf5D on 12/26/2023 in #🔰newbie
How does sendToContentScript from popup work?
I have 2 buttons on my popup, and when I click them, I want them to send a message to the respective contentscript via the sendToContentScript method, where I have a different function to handle each message. To do so, I have created different tsx files for each of the contentScripts. E.g. sendToContentScript({"name" : "generateFields"} is being listened at the generateFields.tsx file and generateFields() function. However, the message being sent for both buttons keeps going only to one of the content scripts even tho the name being called is different. Could anyone help to explain how the sendToContentScript function works in the popup? Thank you
3 replies