-
Notifications
You must be signed in to change notification settings - Fork 6
Async functions
Chung Leong edited this page Feb 25, 2025
·
12 revisions
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.