ITabCloseOperationResponse
This is the response for the Tab Close operation. It extends the IOperationResponse object.
Functions
getResponseData
Use this function to get the response data of Tab Close operation.
Here's the
syntax:
getResponseData(): ITabInfo;The following code sample shows an example in Typescript of the Tab
Closeoperation.
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const tabContext: ITabContext = await frameworkProvider.getTabContext();
const payload: IOperationRequest = frameworkProvider.requestHelper.createPublishRequest('cxEventBusCloseTabOperation');
tabContext.publish(payload).then((message: IOperationResponse) => {
const tabInfo: ITabInfo = (message as ITabCloseOperationResponse).getResponseData();
const browserTabId: string = tabInfo.getTabId();
const msiTabId: string = tabInfo.getMsiTabId();
}).catch((error: IErrorData) => {
// error
});The following code sample shows an example in JavaScript of the Tab Close operation.
const tabContext = await frameworkProvider.getTabContext();
const payload = frameworkProvider.requestHelper.createPublishRequest('cxEventBusCloseTabOperation');
tabContext.publish(payload).then((response) => {
const tabInfo = response.getResponseData();
const browserTabId = tabInfo.getTabId();
const msiTabId = tabInfo.getMsiTabId();
}).catch((error) => {
// error
});
getContext
Use this function to get the context of the response object.
Here's the
syntax:
getContext(): IObjectContext;The following code sample shows an example in Typescript for publishing to the
TabClose operation where the getContext method is
used.
/// <reference path="uiEventsFramework.d.ts"/>
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const tabContext: ITabContext = await frameworkProvider.getTabContext();
const payload: IOperationRequest = frameworkProvider.requestHelper.createPublishRequest('cxEventBusCloseTabOperation');
tabContext.publish(payload).then((message: IOperationResponse) => {
const context: IObjectContext = message.getContext();
}).catch((error: IErrorData) => {
});The following code sample shows an example in JavaScript for publishing to the TabClose operation where the getContext method is used.
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const tabContext = await frameworkProvider.getTabContext();
const payload = frameworkProvider.requestHelper.createPublishRequest('cxEventBusCloseTabOperation');
tabContext.publish(payload).then((response) => {
const context = message.getContext();
}).catch((error) => {
});