OpenModal action in Tab Context
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 openerWindowContext: ITabContext = await uiEventsFrameworkInstance.getTabContext();
const requestObject: IOpenModalWindowRequest = uiEventsFrameworkInstance.requestHelper.createPublishRequest('OpenModal') as IOpenModalWindowRequest;
requestObject.setURL('https://www.wikipedia.org/');
requestObject.setId('modal1');
const response: IModalWindowOperationResponse = await openerWindowContext.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 openerWindowContext = await uiEventsFrameworkInstance.getTabContext();
const requestObject = uiEventsFrameworkInstance.requestHelper.createPublishRequest('OpenModal');
requestObject.setURL('https://www.wikipedia.org/');
requestObject.setId('modal1');
const response = await openerWindowContext.publish(requestObject);
const id = response.getResponseData().getId();
}