Async Functions in JavaScript with Etienne Baudoux

Sign in to queue

Description

In this video Etienne describes the implementation of the Async Function specification for the Microsoft Edge browser. It is a fascinating look at how the Edge browser combines both parsing and native C++ calls to implement this incredibly important pattern. Although much of what is described can already be done with today's JavaScript, the new language feature simplifies the actual code we have to write while ensuring correct behavior. This particular implementation has the added bonus of using a native call to make execution even faster. 

Tags:

JavaScript, Async

Embed

Download

Download this episode

The Discussion

  • User profile image
    Harm Meijer

    Native Promise in Chrome can have you throw errors to reject a promise.

    Throwing error in jQuery Deferred will not work but as far as I know other browsers implement this natively.

    Is Promise coming to IE or do programmers have to go to the "and now test for IE" phase again? Because at some point programmers will likely just skip this part.

  • User profile image
    Major​Breakfast

     

    Nice video, but I do have some issues with the shown examples!

    1.

    async function doSomething(num)

    always returns a promise. The
    await
    in
    return await doSomething(--num)
    doesn't change a thing. Returning the promise outright would work just as well.

    2. 

    async function httpGetJSON(url)
    has the same issue. Plus it doesn't do any JSON parsing! :)

Add Your 2 Cents