correctingInterval exposes two functions, setCorrectingInterval and clearCorrectingInterval, which serve as drop-in replacements for setInterval and clearInterval. Unlike setInterval, the setCorrectingInterval function automatically adjusts to correct subsequent intervals that were delayed due to latency. This is useful if your delayed executions need to occur at predictable intervals. For more information, refer to my related blog post below:

Download correctingInterval.js to your project or install using Bower (bower install correctingInterval). Include the file using a <script> tag. Then, use with the same syntax as you would use setInterval, e.g.:

Download correctingInterval.js to your project or install using Bower (bower install correctingInterval). Include the file as a dependency to your module. correctingInterval is passed as an object containing the two functions as object members, e.g.: