Deno: Get timers working in Rust rewrite

Created on 26 Jul 2018  路  3Comments  路  Source: denoland/deno

Using Tokio

Most helpful comment

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:

  • Isn't what browsers do

Pros:

  • Much nicer API for use with async/await

All 3 comments

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:

  • Isn't what browsers do

Pros:

  • Much nicer API for use with 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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kitsonk picture kitsonk  路  3Comments

somombo picture somombo  路  3Comments

kyeotic picture kyeotic  路  3Comments

zugende picture zugende  路  3Comments

ry picture ry  路  3Comments