Type Alias IntervalOptions

IntervalOptions: {
    callback: (() => void);
    delay: number;
    executeImmediately?: boolean;
    times?: number;
}

Options for configuring an interval timer.

Type declaration

  • callback: (() => void)

    The function to execute at each interval

      • (): void
      • Returns void

  • delay: number

    The time in milliseconds between each execution

  • OptionalexecuteImmediately?: boolean

    Whether to execute the callback immediately before starting the interval timer

  • Optionaltimes?: number

    Optional number of times to execute before auto-clearing. Omit for infinite execution.

const intervalId = timeManager.setInterval({
callback: () => console.log("Will be called 5 times!"),
delay: 1000,
times: 5,
});