I am trying to do a chrome extension. In my extension, icons change when a condition change. I have popup.tsx and background.ts. In popup.tsx, I change my icon. In background.ts, I detect the url changes and if it changes, I want to run my popup script again.
In addition, when I reset my extension, it didnt start to work if I dont open its popup. How can I do these?
Here is my background script:
const dene = () => {
console.log('dene works')
return 'dene'
}
chrome.tabs.onActivated.addListener((activeInfo) => {
console.log('listener works')
chrome.scripting.executeScript(
{
target: { tabId: activeInfo.tabId },
func: dene,
},
() => {
chrome.runtime.lastError
}
)
})