previous | top | next
Blocking requests
var output = document.getElementById("output");
while (true) {
var feed = Ajax.requestJSONP(
"http://www.flickr.com/services/feeds/photos_public.gne",
{ format: "json" }, "jsoncallback");
for (var i=0; i<feed.items.length; ++i) {
var img = document.createElement("img");
img.src = feed.items[i].media.m;
img.height = 80;
output.appendChild(img);
}
hold(5000);
while(output.firstChild)
output.removeChild(output.firstChild);
}
- Again, no callback needed. Browser stays responsive during request.
High-level concurrency for JS - http://www.croczilla.com/stratified