Legitimate uses of IIFEs?

bread at mailed.me.uk bread at mailed.me.uk
Sat Dec 19 22:10:07 UTC 2015


I believe await* has gone from the spec. The correct form would be (at the top-level):

```js


Promise.all(asyncFn1(...), asyncFn2(...),...).then(...)
```


The mistake in Dimitry's example is that the async body was not resolved, not that anonymous async functions are in some way invalid - they're just fine.
On 19 December 2015 20:47:57 -00:00, Fabrício Matté <ultcombo at gmail.com> wrote:

> Good call, Dmitry. Async IIFEs are also useful to parallelize different sequences of async operations. E.g.:
> 
> ```js
> async function main() {
> await* [
> (async () => await seq1op2(await seq1op1()))(),
> (async () => {
> await seq2op1();
> await seq2op2();
> })(),
> ];
> }
> ```
> 
> Here is a more solid example <https://github.com/JSRocksHQ/harmonic/blob/81979aee6c8c9ca981a69d694e0fe025ad7d1669/src/bin/core.js#L23-L37>.
> 
> /fm
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20151219/9b709285/attachment.html>


More information about the es-discuss mailing list