pinterval
    Preparing search index...

    Function times

    • Executes a function a specified number of times with a delay between executions.

      Parameters

      • predicate: TimesPredicate | TimesPredicateAsync

        A synchronous or asynchronous function to be executed on each iteration. The function receives the current iteration count as an argument.

      • amount: number

        The number of times the predicate should be executed. If set to a value less than 0, the method resolves immediately without performing any executions.

      • timeout: Duration

        The delay duration between consecutive executions of the predicate.

      • Optionalstart: StartMode = 'immediate'

        Determines how the interval should begin. Defaults to 'immediate', which executes the first invocation immediately without waiting for the timeout interval.

      Returns Promise<void>

      Resolves when the predicate has been executed the specified number of times or if the specified amount is less than 0. Rejects if an error occurs during predicate execution.