question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Swal.stopTimer() in onOpen function doesn't stop the timerProgressBar

See original GitHub issue

Current 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

https://codepen.io/iversen/pen/ZEGpvZK

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
limontecommented, Mar 15, 2020

Strange, the test I added in #1898 is passing, I’ll check that.

1reaction
limontecommented, Feb 21, 2020

🎉 This issue has been resolved in version 9.8.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found