UNPKG

837 BTypeScriptView Raw
1import { AsyncIterableX } from './asynciterablex';
2/**
3 * Returns an async-iterable sequence that invokes the specified factory function whenever a call to [Symbol.asyncIterator] has been made.
4 *
5 * @export
6 * @template TSource The type of the elements in the sequence returned by the factory function, and in the resulting sequence.
7 * @param {((signal?: AbortSignal) => AsyncIterable<TSource> | Promise<AsyncIterable<TSource>>)} factory Async-iterable factory function to
8 * invoke for each call to [Symbol.asyncIterator].
9 * @returns {AsyncIterableX<TSource>} An async-iterable sequence whose observers trigger an invocation of the given async-iterable factory function.
10 */
11export declare function defer<TSource>(factory: (signal?: AbortSignal) => AsyncIterable<TSource> | Promise<AsyncIterable<TSource>>): AsyncIterableX<TSource>;