JSFiddle - React, Tailwind, and code Playground
JavaScript
// Get the start of code execution
var start = new Date();
// Mimics a long running call for a number of milliseconds
function waitMilliseconds(milliseconds) {
var start = +(new Date());
while(start + milliseconds > +(new Date())) {}
}
var first = true;
setInterval(function() {
var current = new Date();
console.log('setInterval executing: ' + (current - start));
// Make the first execution take 1.5 seconds
if (first) {
waitMilliseconds(1500);
first = false;
}
}, 1000);