Listen to close event of with Reason for Modal Window

We can listen close event from GlobaContext and tabContext with TabId only.

  1. PROGRAMMATIC if the notification closed by close notification action from UEF.
  2. MANUAL if the notification closed by clicking the close icon in the notification .

Here's a Typescript example:

const uiEventsFrameworkInstance: IUiEventsFrameworkProvider= await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
    const modalWindowContext: IModalWindowContext = await uiEventsFrameworkInstance.getModalWindowContext();    
    const requestObject: IWindowSubscriptionRequest = uiEventsFrameworkInstance.requestHelper.createSubscriptionRequest('OnModalCloseAction') as IWindowSubscriptionRequest; 
    requestObject.setId('modal1');   
    modalWindowContext.subscribe(requestObject, (response: IEventResponse) => {   
      let responseData = response as IWindowCloseActionEventResponse;
      console.log((responseData.getResponseData() as IWindowCloseActionData).getWindowId());
      console.log((responseData.getResponseData() as IWindowCloseActionData).getReason());
     });

Here's a JavaScript example:

const uiEventsFrameworkInstance = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
     const modalWindowContext = await uiEventsFrameworkInstance.getModalWindowContext();    
     const requestObject = uiEventsFrameworkInstance.requestHelper.createSubscriptionRequest('OnModalCloseAction'); 
     requestObject.setId('modal1');   
     modalWindowContext.subscribe(requestObject, (response) => {     
         console.log(response.getResponseData().getWindowId());
         console.log(response.getResponseData().getReason());
      });