Created
November 6, 2015 21:22
-
-
Save ovdojoey/2951ecab75ebe191a5ca to your computer and use it in GitHub Desktop.
Image Caching / Preloading
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function imgPreloader () { | |
this.images = new Array(); | |
this.addImages = function(images) { | |
var self = this; | |
if(!images) return; | |
if(Array.isArray(images)) { | |
images.forEach(function (ele) { | |
var _image = new Image(); | |
_image.src = ele; | |
self.images.push(_image); | |
}); | |
} | |
}; | |
return this; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment