polyfills.HTMLCanvasElement.protoype.toBlob.meta.json Maven / Gradle / Ivy
The newest version!
{"browsers":{"chrome":"<50","firefox":"<19","safari":"*","ie":"10","opera":"*"},"dependencies":["atob","Object.defineProperty"],"docs":"https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob","license":"MIT","detectSource":"'toBlob' in HTMLCanvasElement.prototype","testSource":"","baseDir":"HTMLCanvasElement/protoype/toBlob","hasTests":true,"testsSource":"/* eslint-env mocha, browser*/\n/* global proclaim, it */\n\nit('should output a PNG blob', function() {\n\tvar canvas = document.createElement('canvas'),\n\t\tctx = canvas.getContext('2d');\n\tcanvas.height = 10;\n\tcanvas.width = 10;\n\tctx.fillRect(0, 0, 10, 10);\n\n\tcanvas.toBlob(function(blob) {\n\t\tproclaim.equal(blob.constructor, Blob);\n\t\tproclaim.greaterThan(blob.size, 0);\n\t\tproclaim.equal(blob.type, 'image/png');\n\t});\n});\n\nit('should output a JPG blob', function() {\n\tvar canvas = document.createElement('canvas'),\n\t\tctx = canvas.getContext('2d');\n\tcanvas.height = 10;\n\tcanvas.width = 10;\n\tctx.fillRect(0, 0, 10, 10);\n\n\tcanvas.toBlob(function(blob) {\n\t\tproclaim.equal(blob.type, 'image/jpeg');\n\t}, 'image/jpeg');\n});"}