Using Tokio
As an idea - we can ship timers that are awaitable out of the box.
We can implement Symbol.asyncIterator on setInterval and then on setTimeout directly.
Cons:
Pros:
async/await @benjamingr is there a spec for that? We've used await delay(milliseconds) in the past.
We have to provide setTimeout and friends in any case, but I'm not opposed to having delay (or whatever is standard).
@ry there is no standard for that as far as I know - just half-baked proposals and discussions in the Node.js repo and whatwg list.
Node also provides a util.promisify compatible setTimeout which basically does delay.
Most helpful comment
As an idea - we can ship timers that are
awaitable out of the box.We can implement
Symbol.asyncIteratoronsetIntervalandthenon setTimeout directly.Cons:
Pros:
async/await