@epikodelabs/streamix / coroutines/src/public-api / coroutine
Function: coroutine()
coroutine<
T,R>(main, ...rest):Coroutine<T,R> &CoroutineScript<T,R>
Defined in: projects/libraries/streamix/coroutines/src/lib/abstractions/coroutine.ts:58
Creates a reusable coroutine task runner with its worker script baked once.
A coroutine owns one dedicated worker, reuses it across calls, and queues run() submissions on that worker. The returned Coroutine can be used with pipe() in stream pipelines or called directly. Call .dispose() when done to terminate the underlying worker. Raw helper snippets can be provided through an optional trailing options object.
Type Parameters
T
T
R
R
Parameters
main
CoroutineTask<T, R>
rest
...CoroutineDefinitionRest
Returns
Coroutine<T, R> & CoroutineScript<T, R>