trying to find some inefficiencies in Finnish resource

This commit is contained in:
aarne
2010-10-25 19:56:47 +00:00
parent cd0a9982bd
commit e745881e4a
6 changed files with 32 additions and 2 deletions

View File

@@ -25,6 +25,18 @@ function jsonp(url,callback)
document.body.appendChild(script);
}
var json = {next:0};
// Like jsonp, but instead of passing the name of the ballback function, you
// pass the callback function directly, making it possible to use anonymous
// functions.
function jsonpf(url,callback)
{
var name="callback"+(json.next++);
json[name]=function(x) { delete json[name]; callback(x); }
jsonp(url,"json."+name);
}
/* --- HTML construction ---------------------------------------------------- */
function text(s) { return document.createTextNode(s); }