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

I was about to launch the implementation of window.createImageBitmap in
Blink, and I received feedback on the blink-dev mailing list that the
"Promise" API is the wave of the future for asynchronous JS, and that the
new createImageBitmap method should use Promises.

Current spec:
http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#images

The proposal is to change the ImageBitmapFactories IDL to something like
this:

[NoInterfaceObject]
interface ImageBitmapFactories {
  Promise createImageBitmap(ImageBitmapSource image, optional long sx, long
sy, long sw, long sh);
};

The value of the promise would resolve to an ImageBitmap object.

What do we think?

Received on Wednesday, 19 June 2013 13:20:04 UTC