Open lcdsantos opened 8 years ago
When the page has no images, the plugin wait for the maxTime to complete, instead of just completing right away.
maxTime
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
getImageSrcs
if (this.sources.length === 0) { this.done === true; this.updateProgress(); }
Sounds like a good plan! You can add a pull request if you'd like to fix this problem.
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