Workspace API

The workspace API allows you to perform console-related tasks that include opening tabs and subtabs and to adding focus to opened tabs and subtabs. To use the API, you need to include the Lightning Component Lightning :workspaceAPI in the component. 

The following shows the code snippet on how to use the API:

<aura:component implements="flexipage:availableForAllPageTypes" access="global">
    <Lightning :workspaceAPI aura:id="workspace"/>
    <Lightning :button label="Close Focused Tab" onclick="{!c.closeFocusedTab}"/>
</aura:component>

The controller code is as follows:

({    closeFocusedTab : function(component, event, helper) {        var workspaceAPI = component.find("workspace"); workspaceAPI.getFocusedTabInfo().then(function(response) { ...

Get Learning Salesforce Lightning Application Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.