Subscribe Custom Event on GlobalContext

Here's a TypeScript example for adding custom event subscription on GlobalContext.

const subscribeCustomEvent = async () => {
    const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID','V1');
    const payload: ICustomEventSubscriptionRequest = frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusCustomEvent') as ICustomEventSubscriptionRequest;
    payload.setCustomEventName('customEventName');
    const globalContext: IGlobalContext = await frameworkProvider.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())
    });
};

Here's a JavaScript example for adding custom event subscription on GlobalContext.

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