-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
Is there any reason to resolve the loadImage promise even if some image failed loading? Need some identification on my project if there is a failure on image loading.
I was not able to add a pull request. Put my changes in this issue.
@@ -126,7 +126,7 @@ function loadImages(images, imageLoadingInfo) {
*/
function loadImage(src, container) {
// console.log('--> start loading img: %s', src);
- return new Promise((resolve) => {
+ return new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => {
// console.log(`src: ${src}`);
@@ -134,8 +134,7 @@ function loadImage(src, container) {
};
img.onerror = () => {
console.error(`[prefetch-image]: "${src}" failed`);
- //still resolve even if some image failed loading
- resolve(src);
+ reject(src);
};
img.src = src;
container.push(img);Thanks
Reactions are currently unavailable