MCPcopy Create free account
hub / github.com/microsoft/SandDance / loadImage

Function loadImage

docs/app/js/sanddance-app.js:62474–62492  ·  view source on GitHub ↗
(url, opts)

Source from the content-addressed store, hash-verified

62472 });
62473}
62474function loadImage(url, opts) {
62475 (0, _utils.assert)(typeof url === "string");
62476 url = pathPrefix + url;
62477 return new Promise(function(resolve, reject) {
62478 try {
62479 var image = new Image();
62480 image.onload = function() {
62481 return resolve(image);
62482 };
62483 image.onerror = function() {
62484 return reject(new Error("Could not load image ".concat(url, ".")));
62485 };
62486 image.crossOrigin = opts && opts.crossOrigin || "anonymous";
62487 image.src = url;
62488 } catch (error) {
62489 reject(error);
62490 }
62491 });
62492}
62493
62494},{"../utils":"eK1k6","@parcel/transformer-js/src/esmodule-helpers.js":"jA2du"}],"jRimD":[function(require,module,exports) {
62495var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");

Callers

nothing calls this directly

Calls 4

rejectFunction · 0.85
resolveFunction · 0.70
incrementFunction · 0.70
decrementFunction · 0.70

Tested by

no test coverage detected