yarn sweetalert2 2.0.0
Remove closeOnConfirm and closeOnCancel, add preConfirm

latest releases: 11.10.8, 11.10.7, 11.10.6...
8 years ago

Breaking changes in 2.0.0

  1. Remove closeOnConfirm and closeOnCancel parameters.
  2. 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!');
  }
});

Don't miss a new sweetalert2 release

NewReleases is sending notifications on new releases.