callSequence()function

callSequence(sequence: AsyncIterable<T, void, void>, callback: ValueCallback<T>): AsyncGenerator<T, void, void>
ParamType
sequenceAsyncIterable<T, void, void>
The source sequence to relay. required
callbackValueCallback<T>
Callback invoked with each yielded item. required
Return
AsyncGenerator<T, void, void>
An async generator that yields the same items as sequence.

Dispatch items in a sequence to a (possibly async) callback.

  • Calls callback with each item as it arrives, then re-yields the item unchanged.

Examples

for await (const item of callSequence(source, console.log)) use(item);