(dataurl, cb)
| 12382 | }) |
| 12383 | }; |
| 12384 | function dataURLToCanvas(dataurl, cb){ |
| 12385 | if(!dataurl)return cb(null); |
| 12386 | var ctx = canvas.getContext('2d'); |
| 12387 | var img = new Image(); |
| 12388 | img.setAttribute("crossOrigin","anonymous"); |
| 12389 | img.onload = function(){ |
| 12390 | canvas.width = img.width; |
| 12391 | canvas.height = img.height; |
| 12392 | ctx.clearRect(0, 0, canvas.width, canvas.height); |
| 12393 | ctx.drawImage(img, 0, 0); |
| 12394 | cb(canvas); |
| 12395 | }; |
| 12396 | img.onerror = function(){ |
| 12397 | cb(null); |
| 12398 | }; |
| 12399 | img.src = dataurl; |
| 12400 | } |
| 12401 | function urlToBlobWithFetch(urlString, cb){ |
| 12402 | fetch(urlString).then(response => response.blob()).then(blob => { |
| 12403 | let ext = extFromMimeAndUrl(blob.type, urlString); |
no outgoing calls
no test coverage detected