O'Reilly logo

Async JavaScript by Trevor Burnham

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

TameJS

The OkCupid team has created a clever precompiler with more than 600 GitHub watchers (http://tamejs.org/) that adds two keywords to JavaScript, await and defer. An await block defines code that won’t return until each async task defined with defer has been completed.

 
await {
 
setTimeout(defer(), 100);
 
}
 
console.log(​"this will run after the 100ms timeout"​);

The TameJS folks have also created a CoffeeScript fork with the same await/defer mechanism called IcedCoffeeScript (http://maxtaco.github.com/coffee-script/).

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required