callSequence()function
callSequence(sequence: AsyncIterable<T, void, void>, callback: ValueCallback<T>): AsyncGenerator<T, void, void>
| Param | Type | |
|---|---|---|
sequence | AsyncIterable<T, void, void> | The source sequence to relay. required |
callback | ValueCallback<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
callbackwith each item as it arrives, then re-yields the item unchanged.
Examples
for await (const item of callSequence(source, console.log)) use(item);