3 ms·
five.tooSlow = function() { var returnIn = new Date(new Date().valueOf() + 555); do {} while(new Date() < returnIn); return five();
by jgillich 12y ago
five.tooSlow = function() {
var returnIn = new Date(new Date().valueOf() + 555);
do {} while(new Date() < returnIn);
return five();
};
Finally a way to escape callback hell. I think somebody should write a jQuery.ajax plugin that calls the function repeatedly until a request is finished.
- sfeng 12y agoThat actually wouldn't work, as the response from the request would never be processed while you were looping. You can make synchronous requests already though: req = new XMLHttpRequest req.open("some/url", "GET", false); req.send()