NotificationContext
NotificationContext enables you to perform actions and events on Notifications. For example, show Notification, Close Notification, Listen to close notification, Listen to actions in notification. To get the reference to NotificationContext, users can use the getNotificationContext function.
Syntax
getNotificationContext(notificationId: string): Promise<INotificationContext>;
Here's a Typescript example of the getnotification context from the uefFrameworkProvider:
/// <reference path="uiEventsFramework.d.ts"/>
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID', 'v1');
const notificationContext: INotificationContext = await frameworkProvider.getNotificationContext('notificationId');
Here's a Javascript example of the getnotification context from the uefFrameworkProvider:
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID', 'v1');
const notificationContext = await frameworkProvider.getNotificationContext('notificationId');
NotificationContext also enables you to do actions and events on Notifications in a particular tabContext of a browser tab. For example, show Notification, Close Notification, Listen to close notification, Listen to actions in notification.
To get the reference to NotificationContext, use the getNotificationContext function in tabContext.
Here's a Typescript example of the getnotification context from the tabContext:
/// <reference path="uiEventsFramework.d.ts"/>
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID', 'v1');
const tabContext: ITabContext = await frameworkProvider.getTabContext('browserTabId');
const notificationContext: INotificationContext = await tabContext.getNotificationContext('notificationId');
Here's a Javascript example of the getnotification context from the tabContext:
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID', 'v1');
const tabContext = await frameworkProvider.getTabContext('browserTabId');
const notificationContext = await tabContext.getNotificationContext('notificationId');
Supported Operations
Operation Name | Description | Example |
---|---|---|
ShowNotification | Used to show a notification | Open Notification |
CloseNotification | Used to close a notification. | Close Notification |
Supported Events
Event Name | Description | Example |
---|---|---|
Listen close action event | Listens to a closer action of a notification. | Listen close action event |
Listen action trigger event | Listens to the Action button click triggered in a notification. | Listen action trigger event |
Supported Methods
Method Name | Description | Example |
---|---|---|
publish | Publishes an operation in record context. For instance, Open Modal, Close Modal, Open Popup, Close Popup | Publish |
getSupportedActions | Returns actions supported by that record context as an array. | Get supported actions |
getSupportedEvents | Returns actions supported by the context of an array. | Get supported events |