Parameters
- produce: ResolveToValueSync<T> | ArrayLike<T>
- opts: Partial<Readonly<{
allowUndefined: boolean;
count: number;
onComplete: ((withError: boolean) => void);
onStart: (() => void);
signal: AbortSignal;
while: ((count: number) => boolean);
}>>
Returns Generator<T, void, unknown>
Returns value of produce
function
Generates values from
produce
with a time delay.produce
can be a simple function that returns a value, an function, or a generator. Ifproduce
returns undefined, generator exits.This is the synchronous version. repeat allows for delays between loops as well as asynchronous callbacks.
If the AbortSignal is triggered, an exception will be thrown, stopping iteration.