html5Preloader.js
html5Preloader.js copied to clipboard
Files with the same name prevent any events from being triggered.
If you have something like this:
var myLoader = html5Preloader();
myLoader.on('finish', function(){
alert('LOADED');
});
myLoader.on('error', function(){
alert('ERROR');
});
myLoader.addFiles(
'images/1.jpg',
'images/1.jpg',
'images/2.jpg'
);
no event is triggered. But if you add invalid file or remove duplicate, everything works fine.
Hmm, yes... This is due to the URLs being handled as IDs if the ID is not specified, so you have two files with the same ID, and to the preloader it looks like only two files were loaded and three were expected. Trying to do this should probably throw an error instead.