Async Class

Dimitrian Nine dimtimeforever at gmail.com
Mon Feb 19 07:49:07 UTC 2018


 "I think awaitNew MyObject() would fit the thrust of your idea more"

For me more good my first version... async class = return Promise(obj)
But i can agree with others decisions, if in the end i get: easy way to
async new

Some people ask me for some more interesting sample...
Maybe it can help - try create:
```js
//some module
async class FilterImg{
constructor(path,filters){
this.img = await load(path);
if (filters) {await this.use_filters(filters);}
}}
async use_filters(filters){
await filter1(this.image);
await filter2(this.image);
}}//class
export default FilterImg;
//end module

void async finction(){
let FilterImg = (await import(url)).default;
async class ExtFilterImg extends FilterImg{
constructor(path,filters){
await super(path);
if (filters) {await this.use_extFilters(filters);}
}}//class

let extFilter_img = await new FilterImg(path,filters);
console.log(extFilter_img.src+' '+extFilter_img.filters);
}();
```
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180219/5cf21ff8/attachment.html>


More information about the es-discuss mailing list