Async Class

T.J. Crowder tj.crowder at farsightsoftware.com
Sun Feb 18 08:31:43 UTC 2018


On Sun, Feb 18, 2018 at 8:27 AM, Naveen Chawla <naveen.chwl at gmail.com>
wrote:
>
> Like this:
>
> ```js
> class MyObject{
>     constructor(){
>         initializeAsync();
>     }
>
>     async initializeAsync(){
>         await doSomething();
>         await doSomethingElse();
>         //etc.
>     }
> }
> ```

That constructor breaks one of the main rules of promises: Either handle
the rejection, or propagate the promise.

-- T.J. Crowder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180218/73ed4871/attachment.html>


More information about the es-discuss mailing list