diff --git a/lib/canvas.js b/lib/canvas.js index 6a7de5c..11aab6f 100644 --- a/lib/canvas.js +++ b/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) {