Browse Source

Make sure callback isn't executed synchronously

master
Luke Childs 8 years ago
parent
commit
3bd0dffea8
  1. 8
      lib/canvas.js

8
lib/canvas.js

@ -261,7 +261,13 @@ Canvas.prototype.toDataURL = function(a1, a2, a3){
if (this.width === 0 || this.height === 0) {
// Per spec, if the bitmap has no pixels, return this string:
return fn ? fn(null, "data:,") : "data:,";
if (fn) {
setTimeout(function() {
fn(null, "data:,");
});
return;
}
return "data:,";
}
if ('image/png' === type) {

Loading…
Cancel
Save