Async Class

Dimitrian Nine dimtimeforever at gmail.com
Sun Feb 25 06:09:50 UTC 2018


```js
class Test{
constructor(){}
async init(){}
static async newA(){
let obj = new Test(); obj.init(); return obj
}}
let t = Test.newA();

class ExtTest extends Test(){
constructor(){
super(); // we cant init here
//now we must recreate new/init for ExtTest too
}}
```
Or with my proposal we can easily do all async operation in constructor
```js
async class Test{
constructor(){
}}
async class ExtTest extends Test(){
constructor(){
await super();
}}
```
Definition for async class = that async create and return Promise(obj)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180225/0d4f3c05/attachment.html>


More information about the es-discuss mailing list