Closed
Description
In Node.js 15.x, we introduced the concept of awaitable timers... variants of setTimeout()
and setInterval()
that return promises. For instance:
https://nodejs.org/dist/latest-v17.x/docs/api/timers.html#timers-promises-api
import { setTimeout } from 'timers/promises';
// Halts execution for approximately 1 second without blocking the event loop
await setTimeout(1000);
import { setInterval } from 'timers/promises';
// Iterates approximately once per second without blocking the event loop
for await (const _ of setInterval(1000) {
console.log('.');
}
These have proven to be very useful for a number of cases and I believe it's worthwhile to at least discuss whether they should be standardized in some variation within the HTML spec.
Metadata
Metadata
Assignees
Labels
No labels