function async(callback) { setTimeout(callback, 0); }
function async(callback) { var img = new Image; img.addEventListener(error, callback, false); img.src = data:,foo; }
function async(callback) { var script = document.createElement("script"); script.type = "text/javascript"; script.src = "javascript:"; script.onreadystatechange = function () { document.body.removeChild(script); callback(); } document.body.appendChild(script); }
function async(callback) { var script = document.createElement(script); script.onload = function() { document.body.removeChild(script); callback(); } script.src = data:text/javascript,; document.body.appendChild(script); }
function async(callback) { var xhr = new XMLHttpRequest; xhr.open(GET,data:text/plain,foo,true); xhr.onreadystatechange = function() { xhr.onreadystatechange = null; callback(); }; xhr.send(null); }
function async(callback) { var n = ++async.count; window.addEventListener(message,function(e){ if (e.data == n) { window.removeEventListener(message, arguments.callee,false); callback(); } },false); window.postMessage(n, location.protocol + "//" + location.host); } async.count = 0;