Skip to main content

interface AsyncReducer.Instance<I,O>

An async reducer instance that manages its own state based on the reducer definition that was used to create this instance.

Implemented by: InstanceImpl<I,O,S>

Type parameters

NameDescription
Ithe input element type
Othe output element type

Properties

halted

Returns true if the reducer instance does not receive any more values, false otherwise.

Definition

get halted(): boolean;

index

Returns the index of the last received value.

Definition

get index(): number;

Methods

getOutput

Returns the output value based on the current given input values.

Definition

getOutput(): MaybePromise<O>;

halt

Method that, when called, halts the reducer instance so that it will no longer receive values.

Definition

halt(): void;

next

Sends a new value into the reducer instance.

Definition

next(value: I): MaybePromise<void>;

Parameters

NameTypeDescription
valueIthe next input value

onClose

Closes any resources that may have been opened.

Definition

onClose(err?: unknown): Promise<void>;

Parameters

NameTypeDescription
errunknown(optional) if an error occurrerd it can be supplied