I’m working on a Pomodoro application in React and I can’t figure out how to continue updating the page title (<title></title>
) when the browser tab is switched. Is this even possible with React? I know that browsers throttle JavaScript execution when the browser tab is switched but I was wondering if there is a work around for this? For example, the stopwatch on Google, regardless of if the tab is switched, the title continues to update.
What I mean by update is, the tab title in “Work mode” is: Work - 01:20
and when the timer is running and the tab is active, it continues to update with the elapsed time. If I switch tabs for 10 seconds, it stays as Work - 01:20
until I switch back to the tab, then it just jumps to Work - 01:30
.
NOTE: This is not a traditional Pomodoro timer, “Work mode” is a stopwatch not a timer.
For my specific application, I am using React Helmet with a state value that gets updated every second with the elapsed time.