Indicates that a tab has been replaced successfully.
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:
<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
<lightning:workspaceAPI aura:id="workspace" />
<aura:handler event="lightning:tabReplaced" action="{! c.onTabReplaced }"/>
</aura:component>
Controller code:
({
onTabReplaced : function(component, event, helper) {
console.log("Tab Replaced");
var replacedTabId = event.getParam("tabId");
var workspaceAPI = component.find("workspace");
workspaceAPI.getTabURL({
tabId : replacedTabId
}).then(function(response) {
console.log(response);
});
}
})