tabGroups.onRemoved
Fires when a tab group is removed. This occurs when a user closes a tab group or a tab group is closed automatically because another change means it no longer contained any tabs.
In this article
Syntax
js
browser.tabGroups.onRemoved.addListener(listener)browser.tabGroups.onRemoved.removeListener(listener)browser.tabGroups.onRemoved.hasListener(listener)Events have three functions:
addListener(listener)Adds a listener to this event.
removeListener(listener)Stops listening to this event. The
listenerargument is the listener to remove.hasListener(listener)Checks whether
listeneris registered for this event. Returnstrueif it is listening,falseotherwise.
addListener syntax
>Parameters
listenerThe function called when this event occurs. The function is passed this argument:
grouptabGroups.TabGroup. Details of the removed tab group's state.removeInfoobject. Information on why the tab group is closing.isWindowClosingboolean.trueif the tab group is removed because its window is closing.
Examples
Listen for and log tab group removals:
js
function tabGroupRemoved(group) { console.log(`Tab group with ID ${group.id} was removed.`);}browser.tabGroups.onRemoved.addListener(tabGroupRemoved);