JSFiddle - React, Tailwind, and code Playground
by Darker
JavaScript
function reload(cb) {
var req = new XMLHttpRequest();
req.open("GET", location.href);
//Call the callback on request completion
req.onload = function() {
console.log("Reloaded, calling callback.");
if(cb!=null)
cb();
else
console.log(" Callback is null.");
}
//Debug info
console.log("Sending request. Callback: "+cb);
console.log(" Arguments: "+arguments.length);
req.send();
}
function waitReload() {
console.log("Reload in 20 ms.");
//Sending 3 arguments in 20ms
setTimeout(reload, 20, waitReload, "BLE", "Number 666");
}
waitReload();