You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some cases, to access resources that are wrapper maybe will want to make accessible in swal callback when it is triggered.
To do this, we use the known .bind() swal({ title: "Are you sure?", text: "You will not be able to recover this imaginary file!", type: "warning", showCancelButton: true, confirmButtonClass: "btn-danger", confirmButtonText: "Yes, delete it!", cancelButtonText: "No, cancel plx!", closeOnConfirm: false, closeOnCancel: false }, (function(isConfirm) { debugger; if (isConfirm) { swal("Deleted!", "Your imaginary file has been deleted.", "success"); } else { swal("Cancelled", "Your imaginary file is safe :)", "error"); } }).bind());
But when used this technique, in case of cancel, the callback is never called, only when confirm.
The text was updated successfully, but these errors were encountered:
I have tracked the issue, it's caused by the check imposed in dev/modules/handle-click.js line 84, where it only calls the callback if it pass in a regex to ensure the presence of a parameter in function passed. In case the callback is a result of .bind() when passed to .toString() it miss all original function code and returns: function () { [native code] }
In some cases, to access resources that are wrapper maybe will want to make accessible in swal callback when it is triggered.
To do this, we use the known
.bind()
swal({ title: "Are you sure?", text: "You will not be able to recover this imaginary file!", type: "warning", showCancelButton: true, confirmButtonClass: "btn-danger", confirmButtonText: "Yes, delete it!", cancelButtonText: "No, cancel plx!", closeOnConfirm: false, closeOnCancel: false }, (function(isConfirm) { debugger; if (isConfirm) { swal("Deleted!", "Your imaginary file has been deleted.", "success"); } else { swal("Cancelled", "Your imaginary file is safe :)", "error"); } }).bind());
But when used this technique, in case of cancel, the callback is never called, only when confirm.
The text was updated successfully, but these errors were encountered: