Function setintervalByTimeout

  • Executes a given function repeatedly at a specified interval using setTimeout and clearTimeout.

    Parameters

    • func: Function

      The function to be executed.

    • delay: number

      The interval (in milliseconds) at which the function should be executed.

    Returns (() => void)

    A function that, when called, clears the interval and stops the execution of the given function.

      • (): void
      • Returns void