function loadImage(imgSrc) {
  let img = new Image();

  return new Promise(function (resolve) {
    img.onerror = function () {
      new DOMException("Problem loading image.");
    };

    img.onload = function () {
      resolve(img);
    };

    img.src = imgSrc;
  });
}
/**
  * @desc loads image to Image object
  * @param string imageSrc - src for the image
  * @return promise - resolves with loaded image object
*/
@desc loads image to Image object
@param string imageSrc - src for the image
@return promise - resolves with loaded image object
@desc loads image to Image object @param string imageSrc - src for the image @return promise - resolves with loaded image object
function loadImage(imgSrc) {
  let img = new Image();
  return new Promise(function (resolve) {
    img.onerror = function () {
      new DOMException("Problem loading image.");
    };
    img.onload = function () {
      resolve(img);
    };
    img.src = imgSrc;
  });
}
function loadImage ( imgSrc ) { let img = new Image ( ) ; return new Promise ( function ( resolve ) { img . onerror = function ( ) { new DOMException ( "Problem loading image." ) ; } ; img . onload = function ( ) { resolve ( img ) ; } ; img . src = imgSrc ; } ) ; }
@desc loads image to Image object
 @param string imageSrc - src for the image
 @return promise - resolves with loaded image object
@desc loads image to Image object @param string imageSrc - src for the image @return promise - resolves with loaded image object