Customisable setInterval with variating delay and immediate execution (optional)
npm install custom-interval --save
Custom-Interval provides a
setInterval-like API to set and clear custom intervals using
clearCustomInterval. These intervals can be used just like the standard
setInterval, but also come packed with the ability to have custom-stepping on delays:
const clearCustomInterval setCustomInterval = ;const interval =;// Later:;
In this example the callback is executed at a custom interval where the execution times are 100, 150, 300, 300 and then 500 (repeating).
Custom intervals can also fire on the leading edge (immediate execution, but asynchronous):
Check out the API documentation for more info.