Sweetalert: SweetAlert open callback

Created on 19 Feb 2015  ·  14Comments  ·  Source: t4t5/sweetalert

Hello,

Is there any callback that I could use when SweetAlert is totally opened? I need to use some preloading sutff for SweetAlert content, however I was not able to find a callback to allow me to do this.

Any ideas?

Most helpful comment

How can i call onOpen using promises?

All 14 comments

+1. We need a way to provide some optional event callbacks to sweetAlert. (open, confirm, cancel, close).

:+1: I would need this too

It's not the best solution by a long shot but I needed to track something specific on a swal.close event so I unminified the code and added some custom script at line 83 with various returns based on variable values.
One could do the same thing for open, confirm, etc.
Again, not by any means the best solution but no matter how I try I can't get custom events to fire in this. And for a single task it did the trick for me.
Thanks, Tristan, for the awesome plugin. If you saw how much I use SweetAlerts you'd be blown away.
Event callbacks would be a HUGE help, for sure!.

Another :+1: here. This is really essential.

+1 :+1:

+1

Totally support this event callbacks feature request!

waiting for it

+1 Pretty basic.

+1

sweetalert2 now supports open and close callbacks (onOpen and onClose parameters)

+1 waiting for it

SweetAlert 2.0 now opens in a very synchronous way so you should be able to add stuff right after it quite easily.

swal("Hello world!");
// The modal is now open

Please check out the upgrade guide and reopen this issue if there's a special use case that I've missed.

How can i call onOpen using promises?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

krishnamraju picture krishnamraju  ·  3Comments

voodoo6 picture voodoo6  ·  4Comments

Untit1ed picture Untit1ed  ·  5Comments

jamieson99 picture jamieson99  ·  3Comments

AlexV525 picture AlexV525  ·  4Comments