amis-rpc-design/node_modules/rc-image/lib/util.js
2023-10-07 19:42:30 +08:00

18 lines
393 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isImageValid = isImageValid;
function isImageValid(src) {
return new Promise(function (resolve) {
var img = document.createElement('img');
img.onerror = function () {
return resolve(false);
};
img.onload = function () {
return resolve(true);
};
img.src = src;
});
}