OpenPopup action in Tab Context of given TabId
The following example shows the syntax for the getTabContext
method:
getModalWindowContext(): Promise<IModalWindowContext>;
Here's a TypeScript example:
const openModal = async () => {
const uiEventsFrameworkInstance: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('app', 'v1');
const tabContext: ITabContext = await uiEventsFrameworkInstance.getTabContext('tabId');
const requestObject: IOpenModalWindowRequest = uiEventsFrameworkInstance.requestHelper.createPublishRequest('OpenModal') as IOpenModalWindowRequest;
requestObject.setURL('https://www.wikipedia.org/');
requestObject.setId('popup1');
const response: IModalWindowOperationResponse = await tabContext.publish(requestObject) as IModalWindowOperationResponse;
const id:string = response.getResponseData().getId();
}
Here's a JavaScript example:
const openModal = async () => {
const uiEventsFrameworkInstance = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('app', 'v1');
const tabContext = await uiEventsFrameworkInstance.getTabContext('tabId');
const requestObject = uiEventsFrameworkInstance.requestHelper.createPublishRequest('OpenModal');
requestObject.setURL('https://www.wikipedia.org/');
requestObject.setId('popup1');
const response = await tabContext.publish(requestObject);
const id = response.getResponseData().getId();
}