Creates an IntervalFn instance.
The function to execute repeatedly.
Interval time in milliseconds.
Optional
maxRuns: numberOptional. The maximum number of times to run the function before stopping automatically.
Starts the interval timer. If already started, it does nothing.
The function provided in the constructor will be called every ms
milliseconds.
If maxRuns
was set, the interval will stop automatically after that many executions.
Stops the interval timer if it is running.
Clears the internal timer ID so that the function no longer executes.
A utility class to repeatedly execute a function at a fixed interval with start/stop control.
Remarks
This class wraps the native
setInterval
andclearInterval
APIs to provide an easy way to start and stop repeated execution of a function. The interval can optionally run a fixed number of times before automatically stopping.Example: Imports
Example: Usage