Issue:I have multiple sidepanels open in different websites, but I want to show specific information depending on the tab. This information that I need to show is sent from the background script.
Ideal scenario:
From the background script, I can specify the specific sidepanel to whom I can send the message. (similar to sending message to tabs with chrome.tabs.sendmessage)
Current Hack:
When I open the sidepanel for the first time, I store the active tab Id. However, this hack is not really reliable because if there is a lag by the time the user opens the sidepanel and them moving to another tab. this variable will be set incorrectly.
Other potential solutions:
Is it possible to detect the tab Id where the sidepanel is open. I believe this should probably exist since when we enable/set the sidepanel, we specify the tabId, so there's probably a way to figure out the tabId of the sidepanel.
````
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
/// information to show in the sidepanel of this specific tab
})
```
Thank you!