t4t5/sweetalert

Edge: Icon doesn't animate when firing promise while rendering

Open

#716 aperta il 8 set 2017

Vedi su GitHub
 (3 commenti) (1 reazione) (0 assegnatari)TypeScript (2946 fork)batch import
help wanted

Metriche repository

Star
 (22.338 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

This seems to be a MS Edge problem only. I have a confirmation alert that fires a function to restore a user. When the restore function receives a successful response from the server, I want to display a success alert while simultaneously fetching updated data from the server to refresh my view with in the background; however, the success icon animation stops as soon as I call my ajax function to fetch the new data.

            swal({
                title: 'Restore',
                text: 'Are you sure you want to restore this user?',
                icon: 'warning',
                buttons: {
                    cancel: {
                        closeOnClickOutside: false,
                        text: "Cancel",
                        value: false,
                        visible: true,
                        className: "",
                        closeModal: true
                    },
                    confirm: {
                        text: "Confirm",
                        value: true,
                        visible: true,
                        className: "btn-danger",
                        closeModal: true
                    }
                }
            }).then(confirmation => {
                if (confirmation) {
                    this.users[index].restore().done(() => {
                        swal({
                            closeOnClickOutside: false,
                            title: 'Success',
                            text: 'The user has been restored!',
                            icon: 'success',
                            buttons: {
                                confirm: {
                                    text: "Confirm",
                                    value: true,
                                    visible: true,
                                    className: "btn-success",
                                    closeModal: true
                                }
                            }
                        });
                        this.fetch(); // This Ajax function causes the animation to stop
                } else {
                    swal({
                        closeOnClickOutside: false,
                        title: 'Cancelled',
                        text: 'The user has not been restored!',
                        icon: 'error'
                    });
                }
            });

Guida contributor