WebAssembly / wasi-clocks

Clocks API for WASI
40 stars 14 forks source link

Add a way to get a future for a timer. #19

Closed sunfishcode closed 2 years ago

sunfishcode commented 2 years ago

cabi listen needs a future or stream, so add a function that produces a future from a timer, allowing it to be waited for by cabi wait.

An alternative would be to have the new function return a future directly, rather than a resource, however that wouldn't support reading the current time from a timer.

Fixes #18.