Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Using Background Utility Items
1<aura:component implements="lightning:backgroundUtilityItem">
2 <aura:attribute name="limit" default="5" type="Integer" />
3 <aura:handler event="lightning:tabCreated" action="{!c.onTabCreated}" />
4 <lightning:workspaceAPI aura:id="workspace" />
5</aura:component>1({
2 onTabCreated: function(cmp) {
3 var workspace = cmp.find("workspace");
4 var limit = cmp.get("v.limit");
5 workspace.getAllTabInfo().then(function (tabInfo) {
6 if (tabInfo.length > limit) {
7 workspace.closeTab({
8 tabId: tabInfo[0].tabId
9 });
10 }
11 });
12 }
13})Background utility items are added to an app the same way normal utility items are, but
they don’t appear in the utility bar. The
icon appears next to background
utility items on the utility item list. If you have only background utility items in
your utility bar, the utility bar doesn’t appear in your app. You need at least one
non-background utility item in your utility bar for it to appear.