Async Class

Naveen Chawla naveen.chwl at gmail.com
Sat Feb 17 04:42:55 UTC 2018


You can just call an async method from the constructor (without await) -
and then let that async method handle all the asynchronicity.

Does this satisfy your use case?

I think `async constructor` would make more sense than `async class`.
Calling `new MyObjectAsync()` would have to return a promise for the
object, requiring `await` to actually get the object.

My only reservation is that it does require caution not to presume that
`new X()` isn't actually an instance of `X` (but that `await new X()` is).
Otherwise I don't mind it.

On Fri, 16 Feb 2018 at 14:14 Dimitrian Nine <dimtimeforever at gmail.com>
wrote:

> "It gets ugly(ier) when you want to extend that. :-) "
>
> Ok, i get it, but yes i prefer some more sugar like as i suggested before.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180217/84436661/attachment.html>


More information about the es-discuss mailing list