W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2013

[promises] Difficulties with using constructors and promises together

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 19 Jun 2013 15:32:44 -0700
Message-ID: <CAAWBYDDYqyKmbepTkDTzOp1Y00mm=9ad5TQpeY7X45mRKMN8Pw@mail.gmail.com>
To: "www-dom@w3.org" <www-dom@w3.org>
When we're trying to construct an object, the right idiom is to use a
constructor, rather than a factory function.  On the other hand, when
we need to return something async, the right idiom is to use a

What about when we need to construct an object async?

A few examples:
* createImageBitmap()
* TaskScheduler.add() <http://web-alarms.sysapps.org/#interface-taskscheduler>

These two demonstrate both callback and Future-based ways of dealing
with this async object creation, and both are forced into using
factory functions.

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?

Received on Wednesday, 19 June 2013 22:33:30 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:37:02 UTC