GlobalContext
GlobalContext enables you to listen to application-level events and perform application-level operations. It enables listening to tabOpen, tabClose and tabChange events. It also supports TabFocus, TabClose, CustomEvent and InvokeRestApi actions.
To get the reference of GlobalContext, you can use the getGlobalContext function. This function provides a reference to the application GlobalContext.
Syntax
Here's the syntax:
getGlobalContext(): Promise<IGlobalContext>;
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 globalContext: IGlobalContext = await frameworkProvider.getGlobalContext();
Here's code sample in
JavaScript:
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const globalContext = await frameworkProvider.getGlobalContext();
Supported Events
Event Name | Description | Example |
---|---|---|
TabOpen | Started when a new browser tab or an MSI tab is opened. | TabOpen Event |
TabClose | Started when a new browser tab or an MSI tab is changed. | TabClose Event |
TabChange | Started when a browser tab or MSI tab switch happens. | TabChange Event |
CustomEvent | Used to support any business specific custom events. | Subscribe Custom Events |
Supported Operations
Action Name | Description | Example |
---|---|---|
PopOperation | Used to open any page like an in app page or a custom page in a new browser tab or a new MSI tab. | Pop Operation |
InvokeServiceConnection | Used to call any REST API in VB and to fetch its response in an external application. | InvokeServiceConnection Operation |
GetAgentInfo | Used to fetch information about current signed in user. | Agent Info Operation in Global Context |
CustomEvent | Used to support any business specific custom events. | Publish Custom Events |
setChannelAvailability | Enables or disables the phone icon | SetChannelAvailability |
Supported Methods
Method Name | Description |
---|---|
subscribe | Used to subscribe to an event fired from the the Fusion application. |
subscribeOnce | Used to subscribe to 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 in GlobalContext. |
getGlobalContextId | Used to get the unique context ID of the GlobalContext object. |