mazey
    Preparing search index...

    Function repeatUntilConditionMet

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

      Usage:

      import { repeatUntilConditionMet } from "mazey";

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

      Type Parameters

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

      Parameters

      • callback: T

        The callback function to fire.

      • options: RepeatUntilOptions = {}

        Controls the interval, maximum invocation count, callback context, and callback arguments.

      • condition: (result: ReturnType<T>) => 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.

      Returns void