Skip to content

@epikodelabs/streamix


@epikodelabs/streamix / src/public-api / HandoffOptions

Interface: HandoffOptions<T, R> ​

Defined in: projects/libraries/streamix/src/lib/operators/handoff.ts:9

Hooks that handoff uses to build, validate, and release the resources it swaps in.

Type Parameters ​

T ​

T

R ​

R

Methods ​

prepare() ​

prepare(value, signal): R | Promise<R>

Defined in: projects/libraries/streamix/src/lib/operators/handoff.ts:18

Builds the resource for a source value — for example, starts loading an image, opening a connection, or mounting a worker.

Runs while the previous resource is still active. The signal aborts when a newer source value makes this one stale; use it to cancel in-flight work. Created resources are released through dispose, not here.

Parameters ​

value ​

T

signal ​

AbortSignal

Returns ​

R | Promise<R>


ready() ​

ready(resource, signal): unknown

Defined in: projects/libraries/streamix/src/lib/operators/handoff.ts:27

Resolves when the prepared resource is safe to use — for example, after an image decodes, a connection opens, or a component mounts.

The resource enters the output only after this settles successfully. Rejecting disposes the resource and fails the output while this value is still the latest. The resolved value is ignored.

Parameters ​

resource ​

R

signal ​

AbortSignal

Returns ​

unknown


dispose() ​

dispose(resource): void | Promise<void>

Defined in: projects/libraries/streamix/src/lib/operators/handoff.ts:33

Releases a resource after it is replaced, superseded, or failed, or when the output completes. Each prepared resource is disposed at most once; returned rejections are ignored.

Parameters ​

resource ​

R

Returns ​

void | Promise<void>

Released under the MIT License.