Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
Testing in unknown unknown
Test
Ops/sec
using RunAsync
// async test var task = Task.run(function(){ //dispath something to UI thread var millisecondsToWait =500; setTimeout(function(){ dispatch(function(){ $("body").append("<button>yay....</button>"); }); }, millisecondsToWait);
return millisecondsToWait; });
//execute something after the background task, in the UI thread task.when(function(value){ $('#clickme').text("#"+value+" done!"); console.log("my async code #"+value+" completed!!"); console.log("output: "+ value); });
//after the previous task ends, spin up a new task //with its result as argument task.continueWith(function(value){ return value; }).when(function(value){ console.log("result from task "+ value); deferred.resolve(); });
pending…
using synchronous code
//dispath something to UI thread var millisecondsToWait =500; setTimeout(function(){ dispatch(function(){ $("body").append("<button>yay....</button>"); }); }, millisecondsToWait);
var idx =10, value =40; $('#clickme').text("#"+idx+" done!"); console.log("my async code #"+idx+" completed!!"); console.log("output: "+ value);
//after the previous task ends, spin up a new task //with its result as argument var bla =(function(value){ return value; })(20);
var blu =(function(value){ console.log("result from task "+ value); })(50);
0 comments