Tech
Building a fullscreen countdown timer in vanilla JS: accurate time, Wake Lock, and a WebAudio alarm
Timers look trivial until you actually build one that people rely on. "Just setInterval and decrement a number," right? That gets you a timer that quietly drifts, silently dies when the tab sleeps, and forgets to make a sound at zero.
I recently built a fullscreen countdown timer as a plain-JS canvas widget (it powers the timer pages on blankscreen.io ), and three things turned out to be more interesting than expected:
Keeping accurate time without setInterval drift
Stopping the...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to