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

Kaffeine

Kaffeine is a precompiler that touts itself as “Extended JavaScript.”[64] Among other features, the language offers a simple syntactic sugar for un-nesting callbacks: just add ! after an async function’s name. Kaffeine assumes that the function takes a callback as its last argument and simply transforms all code after that call into the callback.

For example, in a jQuery application, it’s common to want everything to run from within a $ callback (after the document is ready). With Kaffeine, that’s easily done.

 
$!()
 
alert(​'The document is ready.'​);

Although it doesn’t have as big a following as CoffeeScript, features like this make Kaffeine well worth checking out. The CoffeeScript forks Coco and LiveScript have a similar feature, ...

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