Function repeatSync

  • Generates values from produce with a time delay. produce can be a simple function that returns a value, an function, or a generator. If produce 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.

    Type Parameters

    Parameters

    • produce: ResolveToValueSync<T> | ArrayLike<T>

      Function/generator to use

    • opts: Partial<Readonly<{
          allowUndefined: boolean;
          count: number;
          onComplete: ((withError: boolean) => void);
          onStart: (() => void);
          signal: AbortSignal;
          while: ((count: number) => boolean);
      }>>

      Options

    Returns Generator<T, void, unknown>

    Returns value of produce function