Skip to main content

Function: pumpEvents()

pumpEvents<E, R>(run, options?): AsyncGenerator<E, R, unknown>

Defined in: packages/core/src/utils/event-pump.ts:17

Start run and read what it emits, in order, then its result.

run starts at once and gets emit; each emitted event is yielded in the order it arrived, however run schedules its callbacks. Once run settles and every event before it has been read, the iterator returns run's value or throws its error. Events are kept until read, none dropped. With a signal, an abort ends the read at once by throwing the signal's reason, whether or not run has stopped.

Type Parameters​

E​

E

R​

R

Parameters​

run​

(emit) => Promise<R>

options?​

signal?​

AbortSignal

Returns​

AsyncGenerator<E, R, unknown>