what is the event for swal close by another swal. Means if a swal is already present, in the mean time another swal is fired, I want to know the dismissal event of closed swal. what is the procedure for this?
I've tried these
var share = {
showConfirmButton: false,
html: `<div class="card">
<div class="card-header card-header-icon" data-background-color="rose">
<i class="material-icons">screen_share</i>
</div>
<div class="card-content">
<h4 class="card-title">Shared screen</h4>
<div id="view-share">
<div id="test`+ streamId +`"></div>
</div>
</div>
</div>`,
onOpen: () => {
console.log('showing share', streamId);
shareStream.show('test' + streamId, 'Shared');
Shared.openShare.set('stream', shareStream);
},
onClose:() => {
console.log('share window closed');
},
allowOutsideClick: false,
background: 'transparent',
showCloseButton: true,
width: '800px',
// grow: 'fullscreen'
};
swal(share).then(() => { }, (dismiss) => {
console.log(dismiss);
// if (dismiss == 'cancel') {
this.minimize(shareStream);
Shared.openShare.clear();
// }
});
Chaining modals won't work for me. Scenario is I've rendering remote screen shares in swal modal. Sometimes it might happen that another screen share can come to me. When that new share comes, I want to minimize the share to a pane for minimization and open a swal for the new one. Otherwise previous shares will be lost as swal does not fire any event before closing already shown swal.
code from swal2 library
var init = function init(params) {
// Clean up the old modal if it exists
var c = getContainer();
if (c) {
c.parentNode.removeChild(c);
}
I've already implemented it by storing the shown stream information in a variable. whenever showShare
method is called, I'm checking if there is any information stored in that variable. If it is there, minimisation code is called, then new swal is displayed.
if (Shared.openShare.size>0) {
this.minimize(Shared.openShare.get('stream'));
}
But if there is any neat and clean way, it would be better.