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 screen from sleeping mid-countdown (Screen Wake Lock API)
A clean alarm beep with WebAudio — no audio files






