Last active
August 9, 2018 21:14
-
-
Save kllaudyo/eda3c3b32d89640b81418164ea650cde to your computer and use it in GitHub Desktop.
Simple preload images
This file contains 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
const preload = () => { | |
const images = []; | |
for(let i=arguments.length;i--;){ | |
const index = images.length; | |
images[index] = new Image(); | |
images[index].src=arguments[i]; | |
} | |
return images; | |
}; | |
/* | |
preload( | |
"/images/sync.png", | |
"/images/sync-alert.png", | |
"/images/sync-not.png" | |
); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment