GlobalContext

GlobalContext enables you to listen to application-level events and perform application-level operations.

For example, it enables listening to tabOpen, tabClose and tabChange events. It also supports TabFocus, TabClose, CustomEvent, and InvokeRestApi Actions.

Supported events are as follows:

Event Name Description
TabOpen This event is initiated when a new browser tab or a Msi tab is opened.
TabClose This event is initiated when a browser tab or MSI tab is closed
TabChange This event is initiated when a browser tab or MSI tab switch happens

To get the application reference to GlobalContext, you can use the getGlobalContext function.

The following code sample provides a reference to the application:
getGlobalContext(): Promise<IGlobalContext>;
The following code sample shows an example in TypeScript:
/// <reference path="uiEventsFramework.d.ts"/>
const  frameworkProvider : CX_SVC_UI_EVENTS_FRAMEWORK.IUiEventsFrameworkProvider  = await 
CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID');
const globalContext: CX_SVC_UI_EVENTS_FRAMEWORK.IGlobalContext = await  frameworkProvider.getGlobalContext();
The following code sample shows an example in JavaScript:
const frameworkProvider = await 
CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID');
const globalContext = await  frameworkProvider.getGlobalContext();