On Sun, Dec 20, 2015 at 7:32 PM, <[email protected]> wrote:

> there is no reason to create an async function to invoke another async
> function; one can simply invoke it, and if the result/completion is
> required, use it's ,then() member....but there's no need/advantage to
> wrapping such an invocation in an IIAFE, right?


I believe the advantage is that you can then replace the
`.then(onFulfilled, onRejected)` constructs with `await/try/catch`, thus
simplifying the code and improving readability. I recognize this may be an
uncommon pattern though, as most often the caller of an async function will
be an async function as well. Note that I say "uncommon" referring to async
IIFEs inside non-async functions; async IIFEs are still very useful to
parallelize sequences of async operations as I've mentioned before.

Btw, the term "IIAFE" should probably be avoided, as the "A" can
ambiguously mean "Arrow" or "Async".

/fm
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to