OpenModal action in Modal Window Context
Here's how you can access ModelWindowContext:
const uiEventsFrameworkInstance: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
const modalWindowContext:IModalWindowContext = await getModalWindowContext();
Here's a TypeScript example:
const openModal = async () => {
const uiEventsFrameworkInstance: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('app', 'v1');
const modalWindowContext: IModalWindowContext = await uiEventsFrameworkInstance.getModalWindowContext();
const requestObject: IOpenModalWindowRequest = uiEventsFrameworkInstance.requestHelper.createPublishRequest('OpenModal') as IOpenModalWindowRequest;
requestObject.setURL('https://www.wikipedia.org/');
requestObject.setId('modal1');
requestObject.setPropagateToTabs(true);
const response: IModalWindowOperationResponse = await modalWindowContext.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 modalWindowContext = await uiEventsFrameworkInstance.getModalWindowContext();
const requestObject = uiEventsFrameworkInstance.requestHelper.createPublishRequest('OpenModal');
requestObject.setURL('https://www.wikipedia.org/');
requestObject.setId('modal1');
requestObject.setPropagateToTabs(true);
const response = await modalWindowContext.publish(requestObject);
const id = response.getResponseData().getId();
}