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, which it calls backcalls. In Coco/LiveScript, the previous example would be written like this:
| <- $ |
| alert 'The document is ready' |
The Kaffeine/Coco/LiveScript approach provides much of the power of TameJS/StratifiedJS, with less of a learning curve.
3.145.158.95