Listen to close event of the notification with Reason for popup window
We can listen close event from GlobaContext and tabContext with TabId and MSITabContext
- PROGRAMMATIC if the notification closed by close notification action from UEF.
- MANUAL if the notification closed by clicking the close icon in the notification.
- TABCLOSE if the popup closed by close of MSITab (only for Popup in MSITab).
Here's a Typescript example:
onst uiEventsFrameworkInstance: IUiEventsFrameworkProvider= await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
const modalWindowContext: IModalWindowContext = await uiEventsFrameworkInstance.getModalWindowContext();
const requestObject: IWindowSubscriptionRequest = uiEventsFrameworkInstance.requestHelper.createSubscriptionRequest('OnPopupCloseAction') as IWindowSubscriptionRequest;
requestObject.setId('popup1');
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('OnPopupCloseAction');
requestObject.setId('popup1');
modalWindowContext.subscribe(requestObject, (response) => {
console.log(response.getResponseData().getWindowId());
console.log(response.getResponseData().getReason());
});