The starting number for the countdown. If less than or equal to 0, resolves immediately with 0.
The interval in milliseconds between each countdown tick. Defaults to 1000ms (1 second). If less than or equal to 0, it is set to 1ms.
Optional
intervalAction: (left: number) => boolean | voidAn optional callback invoked at each tick with the current count left. If this callback returns false
, the countdown stops early.
A Promise that resolves with the remaining count (usually 0) when the countdown finishes or is stopped early, or rejects if an error occurs in the intervalAction.
Starts a countdown from the specified number, invoking an optional action at each interval.