"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

/**
 * @param  {string} src
 * @param  {} crossOrigin='Anonymous'
 * @returns {Promise}
 */
function loadImage(src) {
  var crossOrigin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Anonymous';
  return new Promise(function (resolve, reject) {
    var image = new Image();
    image.crossOrigin = crossOrigin;

    image.onload = function () {
      return resolve(image);
    };

    image.onerror = function () {
      return reject(Error("image: ".concat(src, " load failed")));
    };

    image.src = src;
  });
}

var _default = loadImage;
exports.default = _default;