zigar.function.Generator(T) - chung-leong/zigar GitHub Wiki
Define a generator type that will act as an interface to a JavaScript
async generator object. When yield()
is called with a value, the generate returns a
value on the JavaScript side. When the function is given an error instead, then the
generator throws.
Arguments:
T
:type
Payload type. Must be anoptional
type.
Struct fields:
ptr
:?*anyopaque
Optional opaque pointer that gets passed tocallback
. Default tonull
.callback
*const fn (?*anyopaque, T) void
Pointer to callback function that's called byyield()
.
Constants:
payload
=T
Functions: