Skip to main content

Class: ProgressiveIterator<T>

A progressive iterator is an async iterator that can have data delivered to it, with newer ones replacing older iterations which have not yet been consume. That allows iterating over sets of values and delivering updates, but always getting the most recent instance.

Type Parameters

T

Constructors

new ProgressiveIterator()

new ProgressiveIterator<T>(name?): ProgressiveIterator<T>

Parameters

name?: any

Returns

ProgressiveIterator<T>

Defined in

packages/core/src/utilities/ProgressiveIterator.ts:21

Properties

done

done: any

Defined in

packages/core/src/utilities/ProgressiveIterator.ts:14


name?

optional name: string

Defined in

packages/core/src/utilities/ProgressiveIterator.ts:15

Methods

[asyncIterator]()

[asyncIterator](): AsyncGenerator<any, void, unknown>

Async iteration where the delivered values are the most recently available ones, so not necessarily all values are ever seen.

Returns

AsyncGenerator<any, void, unknown>

Defined in

packages/core/src/utilities/ProgressiveIterator.ts:84


add()

add(x, done): void

Add a most recent result, indicating if the result is the final one

Parameters

x: T

done: boolean = false

Returns

void

Defined in

packages/core/src/utilities/ProgressiveIterator.ts:49


donePromise()

donePromise(): Promise<T>

Returns

Promise<T>

Defined in

packages/core/src/utilities/ProgressiveIterator.ts:174


forEach()

forEach(callback, errorCallback): Promise<void>

Runs the forEach method on this filter

Parameters

callback: any

errorCallback: any

Returns

Promise<void>

Defined in

packages/core/src/utilities/ProgressiveIterator.ts:111


generate()

generate(processFunction, errorCallback?): Promise<unknown>

Calls an async function to generate the results on the iterator

Parameters

processFunction: any

errorCallback?: ErrorCallback

Returns

Promise<unknown>

Defined in

packages/core/src/utilities/ProgressiveIterator.ts:143


getDonePromise()

getDonePromise(): PromiseIterator<T>

Returns

PromiseIterator<T>

Defined in

packages/core/src/utilities/ProgressiveIterator.ts:187


getNextPromise()

getNextPromise(): PromiseIterator<T>

Returns

PromiseIterator<T>

Defined in

packages/core/src/utilities/ProgressiveIterator.ts:181


getRecent()

getRecent(): T

Gets the most recent value, without waiting

Returns

T

Defined in

packages/core/src/utilities/ProgressiveIterator.ts:73


nextPromise()

nextPromise(): Promise<T>

Returns

Promise<T>

Defined in

packages/core/src/utilities/ProgressiveIterator.ts:165


reject()

reject(reason): void

Reject the fetch. This will prevent further iteration.

Parameters

reason: Error

Returns

void

Defined in

packages/core/src/utilities/ProgressiveIterator.ts:67


resolve()

resolve(): void

Returns

void

Defined in

packages/core/src/utilities/ProgressiveIterator.ts:58


as()

static as(promise): any

Casts a promise, progressive iterator or promise iterator to a progressive iterator, creating one if needed to resolve it.

Parameters

promise: any

Returns

any

Defined in

packages/core/src/utilities/ProgressiveIterator.ts:28