Swal.stopTimer() in onOpen function doesn't stop the timerProgressBar
See original GitHub issueCurrent behavior
When executing Swal.stopTimer()
in the onOpen
function of the Sweetalert, it does stop the timer, but the timer animation from timerProgressBar
still runs.
This is currently “fixed” by executing Swal.stopTimer()
10ms after the onOpen
function runs;
setTimeout(Swal.stopTimer, 10);
Expected behavior
The timerProgressBar
should stop / be paused as well.
Live demo
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
SweetAlert2 - a beautiful, responsive, customizable and ...
When an alert is dismissed by the user, the Promise returned by Swal.fire() will be resolved with an object { isDismissed: true, dismiss:...
Read more >sweetalert2 cancel timer/timeout - javascript - Stack Overflow
I'm the author of SweetAlert2, and a new version with Swal.stopTimer() support was just released. Here's how you can use it:.
Read more >sweetalert2.d.ts - UNPKG
function getTimerLeft(): number | undefined; /** * Stop timer. ... Normalizes the arguments you can give to Swal.fire() in an object of type ......
Read more >sweetalert2@10.3.1 - runpkg
return obj && typeof Symbol === "function" && obj.constructor === Symbol ... return elementByClass(swalClasses['timer-progress-bar']); ... Stop timer.
Read more >sweetalert2.min js Code Example - Code Grepper
const Toast = Swal.mixin({. 2. toast: true,. 3. position: 'top-end',. 4. showConfirmButton: false,. 5. timer: 3000,. 6. timerProgressBar: true,.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Strange, the test I added in #1898 is passing, I’ll check that.
🎉 This issue has been resolved in version 9.8.1 🎉
The release is available on:
Your semantic-release bot 📦🚀