Newer Version Available
force:tabFocused
Response
| Name | Type | Description |
|---|---|---|
| previousTabId | string | The ID of the previously focused tab. |
| currentTabId | string | The ID of the currently focused tab. |
Example
This example prints a line to the browser’s developer console when a tab is focused, and then returns that tab’s tabInfo object using the getTabInfo() method.
Component code:
1<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
2 <force:workspaceAPIAccess aura:id="workspace" />
3 <aura:handler event="force:tabFocused" action="{! c.onTabFocused }"/>
4</aura:component>Controller code:
1({
2 onTabFocused : function(component, event, helper) {
3 console.log("Tab Focused");
4 var focusedTabId = event.getParam('currentTabId');
5 var workspaceAPI = component.find("workspace");
6 workspaceAPI.getTabInfo({
7 tabId : focusedTabId,
8 callback : function(error, response){
9 console.log(response);
10 }
11 });
12 }
13})