Skip to content

Interface: CoroutineLike<T, R>

Defined in: operators/cascade.ts:16

A coroutine-like operator that can process tasks asynchronously in the background. Extends the base Operator interface to provide task processing capabilities with proper resource cleanup.

This interface combines the properties of a stream Operator with the functionality of a standalone coroutine, allowing it to be used for both stream transformations and direct, one-off data processing.

Extends

Type Parameters

T

T = any

The type of the input value.

R

R = T

The type of the output value.

Properties

name?

optional name: string

Defined in: abstractions/operator.ts:32

An optional name for the operator, useful for debugging.

Inherited from

Operator.name


type

type: "operator"

Defined in: abstractions/operator.ts:36

A type discriminator to identify this object as an operator.

Inherited from

Operator.type


apply()

apply: (source) => AsyncIterator<R>

Defined in: abstractions/operator.ts:42

The core function that defines the operator's transformation logic. It takes an asynchronous iterator of type T and returns a new asynchronous iterator of type R.

Parameters

source

AsyncIterator<T>

The source async iterator to apply the transformation to.

Returns

AsyncIterator<R>

Inherited from

Operator.apply


processTask()

processTask: (data) => Promise<R>

Defined in: operators/cascade.ts:24

Processes a single piece of data asynchronously. This method allows the coroutine's logic to be called directly, outside of a stream pipeline.

Parameters

data

T

The input data to be processed.

Returns

Promise<R>

A Promise that resolves with the processed output.


finalize()

finalize: () => Promise<void>

Defined in: operators/cascade.ts:31

Performs any necessary cleanup and finalization logic. This method is called to release resources held by the coroutine.

Returns

Promise<void>

A Promise that resolves when finalization is complete.

Released under the MIT License.