0

I build a frontend app for managing time. Everything work but when I am switching to another tab (without closing the app tab) the stopwatch is stopped. This is the website: https://tasks-time-manager.netlify.app/ And this is more or less what the code does:

playBtn.addEventListener('click', playBtnClickedHandler);

function playBtnClickedHandler(this: HTMLButtonElement) {
   setTimeout(()=>{
       //Update the UI by 10 miliseconds
    },10)
   }

How can I make the app work when the tab is not currently displayed?

aviram
  • 56
  • 1
  • 7
  • Does this answer your question ? [How can I make setInterval also work when a tab is inactive in Chrome?](https://stackoverflow.com/questions/5927284/how-can-i-make-setinterval-also-work-when-a-tab-is-inactive-in-chrome) – Tyler Durden Dec 28 '21 at 08:23
  • [Huge dupe](https://www.google.com/search?q=stopwatch+tab+javascript+site:stackoverflow.com) – mplungjan Dec 28 '21 at 08:27

0 Answers0