In a popup web-extension that I developing, I want to close a certain tab right before my pop-up closes. I tried doing
function onBlur(){
browser.tabs.remove(tabId);
}
window.addEventListener("blur", onBlur);
However, even though browser.tabs.remove(tabId)
works normally, it does not seem to work when inside the blur
event. Am I doing something wrong? Is there a way to implement this?