logoalt Hacker News

d1sxeyesyesterday at 7:44 PM0 repliesview on HN

Yeah, exactly. Timeout based callbacks register a timer with the runtime, and when the timer is up, then the callback gets added to the end of the task queue (so once the timeout is up, you've got to wait for the current loop iteration to finish executing before your callback gets executed).