I have created a modal popup using the modal UI component. See below:
require(
[
'jquery',
'Magento_Ui/js/modal/modal'
],
function(
$,
modal
) {
var options = {
type: 'popup',
responsive: true,
innerScroll: false,
title: 'Modal Title Goes Here',
buttons: [{
text: $.mage.__('Continue'),
click: function () {
this.closeModal();
},
}]
};
var popup = modal(options, $('#modal'));
$('#modal').modal('openModal');
}
);
Is there any way that you can detect when the user closes the modal and trigger a function once this event fires?