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

Ian Hickson ian at hixie.ch
Wed Jul 17 14:57:50 PDT 2013


On Thu, 18 Jul 2013, Silvia Pfeiffer wrote:
> >
> > There are basically two styles:
> >
> >  - constructors (new Date(), new Function(), etc)
> >  - factory methods on the "parent" object (document.createElement(),
> >    implementation.createDocument(), context.createLinearGradient(), etc)
> 
> Do we have a strategy for moving to Promises for all sync factory 
> methods across the API?

Using Promises vs the issue of the factory method names are two orthogonal 
issues.

We can't change old APIs to use Promises (and indeed in most cases they're 
not needed, e.g. all those I cite above). If you don't need a promise, you 
should really just use a constructor.


> I'm asking because it seems like a big change of programming pattern and 
> not everyone may be ready to move on from the old one yet (read: this is 
> next generation technology), so would it be better to keep both 
> interfaces around for a while?

We can never remove functionality. I don't think it's ever good to have 
duplicate functionality. But in this case I think this is a non-issue.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list