W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2013

Re: [promises] Difficulties with using constructors and promises together

From: François REMY <francois.remy.dev@outlook.com>
Date: Thu, 20 Jun 2013 19:28:16 +0200
Message-ID: <DUB120-DS15F50ABDC7ABFBFD1DB905A58E0@phx.gbl>
To: "Tab Atkins Jr." <jackalmage@gmail.com>, "Anne van Kesteren" <annevk@annevk.nl>
Cc: <www-dom@w3.org>, <public-script-coord@w3.org>
> On Wed, Jun 19, 2013 at 6:54 PM, Anne van Kesteren <annevk@annevk.nl> 
> wrote:
> > On Thu, Jun 20, 2013 at 7:32 AM, Tab Atkins Jr. <jackalmage@gmail.com> 
> > wrote:
> >> Is this just what we'll have to do?  Whenever an object can only be
> >> created async, we have to add an "Interface.create()" function?  Or is
> >> there a better solution floating around somewhere that I can't see?
> >
> > Yeah, that's what I suggested to Ian:
> >
> > promise = ImageBitmap.create(...)
> >
> > Not really sure what else you can do, but maybe public-script-coord has 
> > ideas.
>
> Okay, I'll take this thread over to public-script-coord.  Thanks!
>
> ~TJ

Not saying this is best, but you also have the Builder pattern for this, and 
the nested class possibilities:

    var bmp = await new ImageBitmap.Promise(...)

where ImageBitmap.Promise inherits from Future<ImageBitmap> 
Received on Thursday, 20 June 2013 17:28:44 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:13 UTC