queryloader2 icon indicating copy to clipboard operation
queryloader2 copied to clipboard

Slow loading if no images found.

Open lcdsantos opened this issue 9 years ago • 1 comments

When the page has no images, the plugin wait for the maxTime to complete, instead of just completing right away.

Example: http://jsbin.com/dureti/edit?html,output - Contains 1 image, loads pretty fast. http://jsbin.com/henaba/edit?html,output - Has no images, takes really long time to complete.

What if we add a check after getImageSrcs function on https://github.com/Gaya/queryloader2/blob/183e0c0ae129300982c8e68e5eaba1f0c87c0d41/src/ImagePreloader/index.js#L29

if (this.sources.length === 0) {
  this.done === true;
  this.updateProgress();
}

lcdsantos avatar Dec 03 '15 15:12 lcdsantos

Sounds like a good plan! You can add a pull request if you'd like to fix this problem.

Gaya avatar Dec 06 '15 14:12 Gaya