await setTimeout in async functions
Andrea Giammarchi
andrea.giammarchi at gmail.com
Tue Feb 28 23:22:03 UTC 2017
> it was obvious from the example that it's important that `computeResult`
isn't called until after the delay
I was just underlying possible side effects. TBH, I don't even know why
forcing a delay to an async function would be needed but yeah, definitively
on the same page.
I am also a bit against underpowered patterns, like a delay(1000) over
setTimeout since the latter one can be canceled, a delay(1000) without
cancelable Promises is a curse, IMO
¯\_(ツ)_/¯
Regards
On Tue, Feb 28, 2017 at 10:06 PM, T.J. Crowder <
tj.crowder at farsightsoftware.com> wrote:
> On Tue, Feb 28, 2017 at 8:14 PM, Andrea Giammarchi <
> andrea.giammarchi at gmail.com> wrote:
>
>> In the first example, I haven't written this by accident:
>>
>> > also granting you args are those passed at the invocation time and no
>> possible mutation capable of affecting `computeResult` could happen
>> later on?
>>
>
> Okay. With respect, that sentence is *really* unclear, esp. given the
> context that it was obvious from the example that it's important that
> `computeResult` isn't called until after the delay. But we're all on the
> same page now.
>
> -- T.J. Crowder
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170228/899f9ca4/attachment.html>
More information about the es-discuss
mailing list