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

Tab Atkins Jr. jackalmage at gmail.com
Fri Jul 19 10:39:25 PDT 2013


Please don't top-post.

On Thu, Jul 18, 2013 at 6:28 PM, Silvia Pfeiffer
<silviapfeiffer1 at gmail.com> wrote:
> Promises are new to browsers and people who have used them before have
> raised issues about the extra resources they require. It may be a
> non-issue in the browser, but it's still something we should be wary
> of.
>
> Would it be possible for the first browser that implements this to
> have both implementations (callback and Promise objects) and use the
> below code or something a little more complex to see how much overhead
> is introduced by the Promise object and whether it is in fact
> negligible both from a memory and execution time POV?

While there is a nice migration strategy for *legacy* callback-using
code (when called with all callback arguments missing/null, return a
promise instead of nothing), there's no reason to worry about this for
new code.

We're not debating whether or not Promises are useful for the web
platform.  They are, the TAG agrees, multiple new APIs are already
being defined as Promise-based, and older APIs are slowly being
converted.  It's not useful to try and hedge our bets in one-off
situations like this, because the pressures are the same here as
anywhere else.

~TJ



More information about the whatwg mailing list