| 57592 | return _loadToImage.apply(this, arguments); |
| 57593 | } |
| 57594 | function _loadToImage() { |
| 57595 | _loadToImage = (0, _asyncToGeneratorDefault.default)((0, _regeneratorDefault.default).mark(function _callee2(url, options) { |
| 57596 | var image; |
| 57597 | return (0, _regeneratorDefault.default).wrap(function _callee2$(_context2) { |
| 57598 | while(true)switch(_context2.prev = _context2.next){ |
| 57599 | case 0: |
| 57600 | image = new Image(); |
| 57601 | image.src = url; |
| 57602 | if (!(options.image && options.image.decode && image.decode)) { |
| 57603 | _context2.next = 6; |
| 57604 | break; |
| 57605 | } |
| 57606 | _context2.next = 5; |
| 57607 | return image.decode(); |
| 57608 | case 5: |
| 57609 | return _context2.abrupt("return", image); |
| 57610 | case 6: |
| 57611 | _context2.next = 8; |
| 57612 | return new Promise(function(resolve, reject) { |
| 57613 | try { |
| 57614 | image.onload = function() { |
| 57615 | return resolve(image); |
| 57616 | }; |
| 57617 | image.onerror = function(err) { |
| 57618 | return reject(new Error("Could not load image ".concat(url, ": ").concat(err))); |
| 57619 | }; |
| 57620 | } catch (error) { |
| 57621 | reject(error); |
| 57622 | } |
| 57623 | }); |
| 57624 | case 8: |
| 57625 | return _context2.abrupt("return", _context2.sent); |
| 57626 | case 9: |
| 57627 | case "end": |
| 57628 | return _context2.stop(); |
| 57629 | } |
| 57630 | }, _callee2); |
| 57631 | })); |
| 57632 | return _loadToImage.apply(this, arguments); |
| 57633 | } |
| 57634 | |
| 57635 | },{"@babel/runtime/regenerator":"hCi6z","@babel/runtime/helpers/esm/asyncToGenerator":"1U3uv","./svg-utils":"ayAfj","@parcel/transformer-js/src/esmodule-helpers.js":"jA2du"}],"ayAfj":[function(require,module,exports) { |
| 57636 | var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); |