I'm using simple objects to wrap Image objects and track when they are loaded, like so:
var preloader = {
loaded: false,
image: new Image()
}
preloader.image.onload = function() {
preloader.loaded = true;
}
preloader.image.src = 'http://www.example.com/image.jpg';
When the image is finished loading, preloader.loaded is set to true. That all works fine.
My question is, what happens when I have so many of these objects and so many images that the browser cache is used up. Eventually once enough images are loaded, the browser will start to dump older ones out of the cache. In that case won't I end up with JavaScript objects where loaded=true, but the image file is not actually cached anymore?
This is hard to test, because I can't tell at any given point which images are still in the cache and which aren't.