Newer Version Available
lightning:tabReplaced
Response
| Name | Type | Description |
|---|---|---|
| tabId | string | The ID of the replaced tab. |
Example
This example prints a line to the browser’s developer console when a tab is replaced, and then returns that tab’s URL using the getTabURL() method.
Component code:
1<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
2 <lightning:workspaceAPI aura:id="workspace" />
3 <aura:handler event="lightning:tabReplaced" action="{! c.onTabReplaced }"/>
4</aura:component>Controller code:
1({
2 onTabReplaced : function(component, event, helper) {
3 console.log("Tab Replaced");
4 var replacedTabId = event.getParam("tabId");
5 var workspaceAPI = component.find("workspace");
6 workspaceAPI.getTabURL({
7 tabId : replacedTabId
8 }).then(function(response) {
9 console.log(response);
10 });
11 }
12})