Hacker News new | past | comments | ask | show | jobs | submit login

Is it necessary to use a worker for the timer? If you just record the start time, then inconsistent setTimeout calls aren't a problem because each call calculates the duration from start time to current time. Or am I missing something?



You can work out that your 25 minute timer actually took 30 minutes this way, but you can't fix it to make it actually take 25 minutes.


HTTP 203 has a great video about counters (https://www.youtube.com/watch?v=MCi6AZMkxcU)which goes into more details about why counters/timers are a bit more complex.


Yeah, but I think putting it in the worker was about making the timer able to “go off” at a specific time, while the page is backgrounded.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: