@epikodelabs/streamix / AsyncCoordinator
Interface: AsyncCoordinator<T>
Defined in: projects/libraries/streamix/src/lib/utils/coordinator.ts:35
An async iterator that coordinates multiple sources.
Supports dynamic source management and both sync and async draining.
Extends
AsyncIterator<RunnerEvent<T>>
Type Parameters
T
T
The type of value emitted by the sources.
Properties
__tryNext()?
optional__tryNext: () =>IteratorResult<RunnerEvent<T>,any> |null
Defined in: projects/libraries/streamix/src/lib/utils/coordinator.ts:40
Synchronously drain all available values from all sources (if supported). Returns DONE if all sources are complete, otherwise null if no values are available.
Returns
IteratorResult<RunnerEvent<T>, any> | null
__hasBufferedValues()?
optional__hasBufferedValues: () =>boolean
Defined in: projects/libraries/streamix/src/lib/utils/coordinator.ts:45
Returns true if there are buffered values or all sources are done.
Returns
boolean
Methods
addSource()
addSource(
source):number
Defined in: projects/libraries/streamix/src/lib/utils/coordinator.ts:52
Dynamically add a new source to the coordinator.
Parameters
source
AsyncIterator<T>
The async iterator to add.
Returns
number
The index assigned to the new source.
removeSource()
removeSource(
index):Promise<void>
Defined in: projects/libraries/streamix/src/lib/utils/coordinator.ts:58
Remove a source from the coordinator and clean it up.
Parameters
index
number
The index of the source to remove.
Returns
Promise<void>
getActiveSourceCount()
getActiveSourceCount():
number
Defined in: projects/libraries/streamix/src/lib/utils/coordinator.ts:64
Get the number of currently active (non-completed, non-removed) sources.
Returns
number
The count of active sources.
isSourceComplete()
isSourceComplete(
index):boolean
Defined in: projects/libraries/streamix/src/lib/utils/coordinator.ts:71
Check if a specific source is completed or removed.
Parameters
index
number
The source index to check.
Returns
boolean
True if the source is completed or removed, false otherwise.
next()
next(...
__namedParameters):Promise<IteratorResult<RunnerEvent<T>,any>>
Defined in: node_modules/typescript/lib/lib.es2018.asynciterable.d.ts:32
Parameters
__namedParameters
[] | [any]
Returns
Promise<IteratorResult<RunnerEvent<T>, any>>
Inherited from
AsyncIterator.next
return()?
optionalreturn(value?):Promise<IteratorResult<RunnerEvent<T>,any>>
Defined in: node_modules/typescript/lib/lib.es2018.asynciterable.d.ts:33
Parameters
value?
any
Returns
Promise<IteratorResult<RunnerEvent<T>, any>>
Inherited from
AsyncIterator.return
throw()?
optionalthrow(e?):Promise<IteratorResult<RunnerEvent<T>,any>>
Defined in: node_modules/typescript/lib/lib.es2018.asynciterable.d.ts:34
Parameters
e?
any
Returns
Promise<IteratorResult<RunnerEvent<T>, any>>
Inherited from
AsyncIterator.throw