For my chrome extension, I want to perform an action when the browserAction popup window closes. I understand that there no built-in events are triggered when this happens.
For reference, here's the working version of the background.js script:
chrome.runtime.onConnect.addListener(function (externalPort) {
externalPort.onDisconnect.addListener(function () {
console.log("onDisconnect")
// Do stuff that should happen when popup window closes here
})
console.log("onConnect")
})