Re: [whatwg] HTMLCanvasElement toBlob Promise

2015-04-28 Thread Garrett Smith
On 3/18/15, acmesquares . acmesqua...@gmail.com wrote: Admittedly a wrapper function is trivial, mostly for API consistency, and does simply move the callback elsewhere. There is a lot of room for improvement for toBlob. However that's not unprecedented as

Re: [whatwg] HTMLCanvasElement toBlob Promise

2015-04-28 Thread Garrett Smith
On 4/27/15, Garrett Smith dhtmlkitc...@gmail.com wrote: On 3/18/15, acmesquares . acmesqua...@gmail.com wrote: ... My gut tells me two things 1) The canvas API (for toBlob, toDataURL) should have been fixed years ago: 2) don't break the web. I usually am pretty conservative about not

Re: [whatwg] HTMLCanvasElement toBlob Promise

2015-03-18 Thread acmesquares .
Admittedly a wrapper function is trivial, mostly for API consistency, and does simply move the callback elsewhere. However that's not unprecedented as Navigator.mediaDevices.getUserMedia() was just a promisification of an existing API. Nor is the alternative since

Re: [whatwg] HTMLCanvasElement toBlob Promise

2015-03-18 Thread Garrett Smith
On 3/17/15, Ashley Gullen ash...@scirra.com wrote: Making toBlob return a promise is definitely in keeping with the rest of the web platform, but it's easy to write a wrapper function to promisify it. IMO toBlob is better than toDataURL since it is async so the image encoding can happen off

Re: [whatwg] HTMLCanvasElement toBlob Promise

2015-03-17 Thread Ashley Gullen
Making toBlob return a promise is definitely in keeping with the rest of the web platform, but it's easy to write a wrapper function to promisify it. IMO toBlob is better than toDataURL since it is async so the image encoding can happen off main thread, reducing jank. I don't know how easy it is

Re: [whatwg] HTMLCanvasElement toBlob Promise

2015-03-17 Thread Garrett Smith
On 3/14/15, acmesquares . acmesqua...@gmail.com wrote: It would be great if there was a promise-based version of toBlob. Same parameters as toDataURL, but return a Promise to a blob. I use toBlob heavily with other promise APIs, and this one really stands out as in need of modernization. Hi