[whatwg] Proposal: createImageBitmap should return a "Promise" instead of using a callback

Tab Atkins Jr. jackalmage at gmail.com
Thu Jun 20 19:07:56 PDT 2013


On Thu, Jun 20, 2013 at 6:44 PM, Anne van Kesteren <annevk at annevk.nl> wrote:
> On Thu, Jun 20, 2013 at 11:08 PM, Justin Novosad <junov at google.com> wrote:
>> I agree it would be nicer, but it seems less consistent with other existing
>> APIs.
>
> The factory methods we have thus far should probably not be taken as
> precedent. Almost nobody likes them. URL.createObjectURL() is somewhat
> like this, although it returns a string and not a URL object.

And, just to get ahead of any responses along the lines of "well, why
are we doing a factory function here, then?"...

1. It's explained in the OP - we really shouldn't be using real
constructors for this idiom.
2. The reason nobody likes them is because they *should* be
constructors, but we got saddled with silly factory functions instead
because of Java legacy.

~TJ



More information about the whatwg mailing list