@veracity/vui
Version:
Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.
24 lines (23 loc) • 615 B
JavaScript
//#region src/utils/images.ts
const loadImagePromises = /* @__PURE__ */ new Map();
/** Attempts to load the image and returns a boolean indicating success or not. */
function loadImageUrl(url) {
let promise = loadImagePromises.get(url);
if (promise) return promise;
promise = new Promise((resolve) => {
const img = new Image();
img.onload = () => {
resolve(true);
};
img.onerror = () => {
resolve(false);
};
img.src = url;
});
loadImagePromises.set(url, promise);
return promise;
}
//#endregion
export { loadImageUrl };
globalThis.__vuiVersion__ = "5.3.1"
//# sourceMappingURL=images.js.map