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/).
3.142.172.166