Give Each Cooking Timer Its Own Completion Event
@prranitarora▲ 10 net votes
Model each active timer as its own instance with an identifier, deadline, and completion state, even when several timers share a label or duration. When one expires, emit completion for that instance only; avoid a single countdown or boolean that can overwrite another timer status.
1 COMMENT
In browsers, background tabs throttle
setTimeout, so compute remaining time fromDate.now()deadlines rather than counting ticks, and keep each timer handle soclearTimeoutcan cancel a specific one. Seen another edge case with this? Add it below.