Function repeatUntilConditionMet

  • Repeatedly fires a callback function with a certain interval until a specified condition is met.

    Usage:

    repeatUntilConditionMet(
    () => {
    console.log('repeatUntilConditionMet');
    return true;
    }, {
    interval: 1000,
    times: 10,
    context: null,
    args: [],
    }, (result) => {
    return result === true;
    }
    );

    Type Parameters

    • T extends ((...args) => any)

    Parameters

    • callback: T

      The callback function to fire.

    • options: RepeatUntilOptions = {}

      An object containing the options for the function.

    • condition: ((result) => boolean) = ...

      A function that takes the result of the callback function as its argument and returns a boolean value indicating whether the condition has been met. Defaults to a function that always returns true.

        • (result): boolean
        • Parameters

          • result: ReturnType<T>

          Returns boolean

    Returns void