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

Justin Novosad junov at google.com
Wed Jun 19 06:19:35 PDT 2013


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?


More information about the whatwg mailing list