ITabChangeResponse

This object returns the current tab's context and the previous tab's context on a tab change event.

Functions

getCurrentTab

Use this function to get the current tab's context from the TabChange event subscription response.

Here's the syntax:
getCurrentTab(): ITabContext;

getPreviousTab

Use this function to get the previous tab's context from the TabChange event subscription response.

Here's the syntax:
getPreviousTab(): ITabContext;
The following code sample shows an example in Typescript for subscribing to a TabChange event.
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
      const globalContext: IGlobalContext = await frameworkProvider.getGlobalContext();
      const payload: IEventRequest = frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusTabChangeEvent');
      globalContext.subscribe(payload, (response: IEventResponse) => {
          let responseData = response as ITabChangeEventResponse;
          let tabChangeResponse: ITabChangeResponse = responseData.getResponseData();
          let currentTabContext: ITabContext = tabChangeResponse.getCurrentTab();
          let previousTabContext: ITabContext = tabChangeResponse.getPreviousTab();
      });

The following code sample shows an example in JavaScript for subscribing to a TabChange event.

const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
      const globalContext = await frameworkProvider.getGlobalContext();
      const payload = frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusTabChangeEvent');
      globalContext.subscribe(payload, (responseData) => {
          const type: string = response.getType();
          const tabChangeResponse = response.getResponseData().
          const currentTab = tabChangeResponse.getCurrentTab();
          const previousTab = tabChangeResponse.getPreviousTab();
      });