Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rimbu/core/mod.ts>AsyncReducer.Instance

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
interface AsyncReducer.Instance
import { type AsyncReducer } from "https://deno.land/x/rimbu@1.2.0/core/mod.ts";
const { Instance } = AsyncReducer;

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

Methods

getter
halted(): boolean

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

getter
index(): number

Returns the index of the last received value.

halt(): void

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

next(value: I): MaybePromise<void>

Sends a new value into the reducer instance.

getOutput(): MaybePromise<O>

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

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

Closes any resources that may have been opened.

Methods

getter
halted(): boolean

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

getter
index(): number

Returns the index of the last received value.

halt(): void

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

next(value: I): MaybePromise<void>

Sends a new value into the reducer instance.

getOutput(): MaybePromise<O>

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

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

Closes any resources that may have been opened.