JSFiddle - React, Tailwind, and code Playground
JavaScript
var loaded = function (d) {
alert(d)
},
data = "",
count = 0,
repeater = setTimeout(function re() {
data = count++;
setTimeout(re, 100)
}, 0);
requestAnimationFrame(looper=function() { /*dothings*/
if (typeof then === 'undefined') {
requestAnimationFrame(looper)
} else {
loaded(data)
}
});
setTimeout(function () {
clearTimeout(repeater);
then = false;
}, 1000);