Async Class

Naveen Chawla naveen.chwl at
Sun Feb 18 08:27:19 UTC 2018

Like this:

class MyObject{

    async initializeAsync(){
        await doSomething();
        await doSomethingElse();

Of course if you wanted to await at the constructor call level (and await
inside the constructor itself), e.g.

    const myObject = await new MyObject();

...then of course you would need the "async constructor" feature, like
you've requested, but then `new MyObject()` would return a promise.

Personally I have no problem with this:

It suffers from the same bug-set than you would get if you converted a
synchronous function to an asynchronous one (i.e. the need to await).

On Sat, 17 Feb 2018 at 11:13 Dimitrian Nine <dimtimeforever at>

> "You can just call an async method from the constructor (without await) -
> and then let that async method handle all the asynchronicity."
> Not sure about it - how control? callback?
> I prefer async/await then.
> "I think async constructor would make more sense than async class"
> Maybe: i use it for class more for difference between class and async
> class was more visible.
> But yes in total idea about async constructor.
> Both variants work for me.
> What more useful - i dont sure...
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list