4 ms·
Very nice. How about language-level support for asynchronous operations (like the async monad in F#) async update_table:q => r1,err = xhr('http://s
by statictype 17y ago
Very nice. How about language-level support for asynchronous operations (like the async monad in F#)
async update_table:q =>
r1,err = xhr('http://somewhere?q='+q)
if err then
$('error').innerHTML = err
return.
r2,err = xhr('http://somewhere-else?q='+r1)
if err then
$('error').innerHTML = err
return.
$('result').innerHTML = r2
.
could be the equivalent of something like:
function update_table(q) {
var on_error = function(err) { $('error').innerHTML = err; }
doXHR('http://somewhere?q='+q
,function(r1){
doXHR('http://somewhere-else?q='+r1,function(r2){
$('result').innerHTML = r2;
},err));
},err);
);
}