Like Kaffeine, Streamline.js[65] provides a special syntax for transforming the code after an async function call into its callback. Just use _ in place of the callback argument.
| for (var s = 1; s < 60; s++) { |
| setTimeout(_, 1000); |
| console.log(s + ' seconds have elapsed'); |
| } |
| console.log('1 minute has elapsed'); |
Interestingly, Streamline can generate either standard callback-driven JavaScript or fiber-based code for node-fibers (see the next section). Also, unlike most other JavaScript precompilers, Streamline can be used in conjunction with CoffeeScript.
Note that Streamline expects callbacks to follow the Node-style argument list convention (err, results...), which eases error handling in Node but makes it difficult to use for browser development.
3.15.219.174