Lightning Experience is based on event-driven architecture. When a tab is focused, closed, or opened, there are standard handlers that Salesforce provides, which a component can handle.
The following table lists some of the events provided out of the box in the console API to detect changes to the tabs:
Event name | Component markup to handle events | Controller action on event handlers |
Lightning :tabClosed | <aura:component implements="flexipage:availableForAllPageTypes" access="global" > <aura:handler event="Lightning :tabClosed" action="{! c.onTabClosed }"/> </aura:component> | ({ onTabClosed : function(component, event, helper) { var tabId = event.getParam('tabId'); console.log("Tab closed: " ... |