Breaking changes in 2.0.0
- Remove
closeOnConfirm
andcloseOnCancel
parameters. preConfirm
parameter is added, you can pass function to execute before confirm, which should return Promise.
Usage example:
swal({
title: 'Submit to run ajax request',
showCancelButton: true,
confirmButtonText: 'Submit',
showLoaderOnConfirm: true,
preConfirm: function() {
return new Promise(function(resolve) {
setTimeout(function() {
resolve();
}, 2000);
});
},
allowOutsideClick: false
}).then(function(isConfirm) {
if (isConfirm) {
swal('Ajax request finished!');
}
});