Skip to main content

rejectIfConditionAtInterval

Callable

  • rejectIfConditionAtInterval<T>(cond: AsyncFunction<undefined | T, unknown>, interval: number): [Timer, Promise<never>]

  • Sets an interval that repeatedly executes the given cond function with the specified interval between each call. If the condition is met, the interval is cleared and a Promise that rejects with the returned value is returned.


    Type parameters

    • T

    Parameters

    • cond: AsyncFunction<undefined | T, unknown>

      The function/condition to call.

    • interval: number

      The interval in milliseconds.

    Returns [Timer, Promise<never>]

    • an array with the interval ID and the Promise.