NotificationContext
NotificationContextを使用すると、Notificationsでアクションとイベントを実行できます。 たとえば、「通知の表示」、「通知のクローズ」、「通知のクローズのリスニング」、「通知のアクションのリスニング」などです。 NotificationContextへの参照を取得するために、ユーザーはgetNotificationContext関数を使用できます。
構文
構文は次のとおりです:
getNotificationContext(notificationId: string): Promise<INotificationContext>;
uefFrameworkProviderからのgetnotificationコンテキストのTypescriptの例を次に示します:
/// <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');
uefFrameworkProviderからのgetnotificationコンテキストのJavascriptの例を次に示します:
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID', 'v1');
const notificationContext = await frameworkProvider.getNotificationContext('notificationId');
NotificationContextを使用すると、ブラウザ・タブの特定のtabContextでNotificationsのアクションおよびイベントを実行することもできます。 たとえば、「通知の表示」、「通知のクローズ」、「通知のクローズのリスニング」、「通知のアクションのリスニング」などです。
NotificationContextへの参照を取得するには、tabContextのgetNotificationContext関数を使用します。
tabContextからのgetnotificationコンテキストの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('browserTabId');
const notificationContext: INotificationContext = await tabContext.getNotificationContext('notificationId');
tabContextからのgetnotificationコンテキストのJavascriptの例を次に示します:
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID', 'v1');
const tabContext = await frameworkProvider.getTabContext('browserTabId');
const notificationContext = await tabContext.getNotificationContext('notificationId');
サポートされている操作
工程名 | 説明 | 例 |
---|---|---|
ShowNotification | 通知の表示に使用 | 通知を開く |
CloseNotification | 通知のクローズに使用します。 | 通知のクローズ |
サポートされているイベント
イベント名 | 説明 | 例 |
---|---|---|
リスニング・クローズ処理イベント | 通知のより詳細なアクションをリスニングします。 | リスニング・クローズ処理イベント |
リスニング処理トリガー・イベント | 通知でトリガーされた「アクション」ボタンのクリックをリスニングします。 | リスニング処理トリガー・イベント |
サポートされているメソッド
メソッド名 | 説明 | 例 |
---|---|---|
公開 | レコード・コンテキストで操作を公開します。 たとえば、Open Modal、Close Modal、Open Popup、Close Popupなどです | パブリッシュ |
getSupportedActions | そのレコード・コンテキストでサポートされているアクションを配列として返します。 | サポートされるアクションの取得 |
getSupportedEvents | 配列のコンテキストでサポートされているアクションを返します。 | サポートされるイベントの取得 |
ノート: すべての通知イベントおよび操作は、NotificationContextでのみ機能します。