TabContext

TabContext enables you to listen to tab level events such as ContextOpen, ContextClose and perform tab level operations such as FocusTab and CloseTab.

To get the reference of TabContext, users can use the getTabContext function. This function provides a reference to the active tab in which the application is loaded. They can pass the browserTabId as an optional parameter to get a particular browser tab's context.

Syntax

Here's the syntax:
getTabContext(browserTabId?: string): Promise<ITabContext>;
getCurrentBrowserTabContext(browserTabId?: string): Promise<ITabContext>;
getActiveTab(): Promise<ITabContext>;

Parameters

Parameter Name Required? Description
browserTabId No
A particular browser tab's ID.
Note: You can get each browser's tabId value by calling getCurrentTabId API on frameworkProvider from each browser tab.

Code Samples

Here's code sample in TypeScript:

/// <reference path="uiEventsFramework.d.ts"/> 
const frameworkProvider: IUiEventsFrameworkProvider  = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID', 'v1');
const tabContext: ITabContext = await  frameworkProvider.getTabContext();
/// <reference path="uiEventsFramework.d.ts"/> 
const frameworkProvider: IUiEventsFrameworkProvider  = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID', 'v1');
const tabContext: ITabContext = await  frameworkProvider.getCurrentBrowserTabContext();
/// <reference path="uiEventsFramework.d.ts"/> 
const frameworkProvider: IUiEventsFrameworkProvider  = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID', 'v1');
const tabContext: ITabContext = await  frameworkProvider.getActiveTab();
Here's code sample in JavaScript:
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID', 'v1');
const tabContext = await frameworkProvider.getTabContext();
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID', 'v1');
const tabContext = await frameworkProvider.getTabContext();
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID', 'v1');
const tabContext = await frameworkProvider.getActiveTab();

Supported Events

Supported Events

Event Name Description Example
ContextOpen Started when a new object gets opened in a particular tab. ContextOpen Event
ContextClose Started when an object gets closed in a particular tab. Context Close Event
CustomEvent Used to support any business specific custom events. Subscribe Custom Events

Supported Operations

Supported Operations

Action Name Description
FocusTab Used to focus a particular browser or MSI tab.
CloseTab Used to close a particular browser or MSI tab.
PopOperation Used to to pop any page such as in an app page or a custom page in the specified tab context.
GetAgentInfo Used to fetch the information about current logged in user.
CustomEvent Used to support any business specific custom events.
OpenModal Used to open a modal window.
CloseModal Used to close a modal window.
OpenPopup Used to open a dialog box.
ClosePopup Used to close a dialog box.

Supported Methods

Supported Operations

Method Name Description
subscribe Used to subscribe to an event fired from the Fusion application.
subscribeOnce Used to subscribe to a the Fusion application event just once.
publish Used to perform certain operations.
dispose Used to dispose of, or unregister any subscriptions that were added to an event.
getSupportedEvents Used to get the list of supported events in GlobalContext.
getSupportedActions Used to get the list of supported operations inGlobalContext.
getType Returns the type of a tabContext object.
getAvailableTabs Returns all the available tabs on top of a specific tab or its tabContext.
getAvailableRecords Returns all the available records on a specific tab.
getActiveRecord

Returns the active record on a specific tab.

getDependentTabs Returns all the child tabs opened from the tab context.