Async functions - chung-leong/zigar GitHub Wiki

A Zig function becomes an async function on the JavaScript side when it accepts a Promise as an argument. Instead of being returned, the return value will be passed to the promise struct’s resolve() method.

A Generator argument works in a similar manner. Its turns a Zig function into an async generator function on the JavaScript side. Instead of one value, multiple values are returned asynchronously to the caller through the struct's yield() method.


Promise(T) | Generator(T)