function handleReplaced(addedTabId, removedTabId) {
console.log(`New tab: ${addedTabId}`);
console.log(`Old tab: ${removedTabId}`);
}
browser.tabs.onReplaced.addListener(handleReplaced);tabs.onReplaced / notebook
tabs.onReplaced
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.