whole_func_string: function loadImage(src) {
  	  var minWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  	  return new Promise(function (resolve, reject) {
  	    var image = new Image();
  
  	    var handler = function handler() {
  	      delete image.onload;
  	      delete image.onerror;
  	      (image.naturalWidth >= minWidth ? resolve : reject)(image);
  	    };
  
  	    Object.assign(image, {
  	      onload: handler,
  	      onerror: handler,
  	      src: src
  	    });
  	  });
  	}
func_code_string: function loadImage(src) {
  	  var minWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  	  return new Promise(function (resolve, reject) {
  	    var image = new Image();
  
  	    var handler = function handler() {
  	      delete image.onload;
  	      delete image.onerror;
  	      (image.naturalWidth >= minWidth ? resolve : reject)(image);
  	    };
  
  	    Object.assign(image, {
  	      onload: handler,
  	      onerror: handler,
  	      src: src
  	    });
  	  });
  	}
func_documentation_string: ========================================================================== Load image avoiding xhr/fetch CORS issues Server status can't be obtained this way unfortunately, so this uses "naturalWidth" to determine if the image has loaded By default it checks if it is at least 1px, but you can add a second argument to change this ==========================================================================