リスニング・インサイト・アクション実行イベント
recordContextを現在のブラウザ・タブのアクティブ・レコードとみなすTypescriptの例を次に示します:
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID', 'V1');
const tabContext: ITabContext = await frameworkProvider.getCurrentBrowserTabContext();
let recordContext: IRecordContext = await tabContext.getActiveRecord();
let insightContext: IInsightsContext = await recordContext.getInsightsContext();
const payload: IInsightsSubscriptionRequest = frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusOnInsightsActionEvent') as IInsightsSubscriptionRequest;
payload.setId('insightsId1');
insightContext.subscribe(payload, (response: IEventResponse ) => {
const insightsActionEventResponse = response as IInsightsActionEventResponse;
console.log((insightsActionEventResponse.getResponseData() as IInsightsActionData).getInsightsId());
console.log((insightsActionEventResponse.getResponseData() as IInsightsActionData).getActionId());
console.log((insightsActionEventResponse.getResponseData() as IInsightsActionData).getActionName());
});
recordContextを現在のブラウザ・タブ・アクティブ・レコードとみなすJavaScriptの例を次に示します:
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID', 'V1');
const tabContext = await frameworkProvider.getCurrentBrowserTabContext();
let recordContext = await tabContext.getActiveRecord();
let insightContext = await recordContext.getInsightsContext();
const payload = frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusOnInsightsActionEvent');
payload.setId('insightsId1');
insightContext.subscribe(payload, (response) => {
const insightsActionEventResponse = response;
console.log(insightsActionEventResponse.getResponseData().getInsightsId());
console.log(insightsActionEventResponse.getResponseData().getActionId());
console.log(insightsActionEventResponse.getResponseData().getActionName());
});