機械翻訳について

GlobalContextでのカスタム・イベントのサブスクライブ

GlobalContextにカスタム・イベント・サブスクリプションを追加するTypeScriptの例を次に示します。

const subscribeCustomEvent = async () => {
    const payload: ICustomEventSubscriptionRequest = uiEventsFrameworkInstance.requestHelper.createSubscriptionRequest('cxEventBusCustomEvent') as ICustomEventSubscriptionRequest;
    payload.setCustomEventName('customEventName');
    const globalContext: IGlobalContext = await uiEventsFrameworkInstance.getGlobalContext();
    globalContext.subscribe(payload, (message: IEventResponse) => {
        const response: ICustomEventSubscriptionResponse = message as ICustomEventSubscriptionResponse;
        console.log(response.getResponseData());
        console.log(response.getResponseData().getData());
        console.log(response.getResponseData().getCustomEventName())
    });
};

GlobalContextにカスタム・イベント・サブスクリプションを追加するJavaScriptの例を次に示します。

const subscribeCustomEvent = async () => {
    const payload = uiEventsFrameworkInstance.requestHelper.createSubscriptionRequest('cxEventBusCustomEvent');
    payload.setCustomEventName('customEventName');
    const globalContext = await uiEventsFrameworkInstance.getGlobalContext();
    globalContext.subscribe(payload, (response) => {
        console.log(response.getResponseData());
        console.log(response.getResponseData().getData());
        console.log(response.getResponseData().getCustomEventName())
    });
};