Last active
November 20, 2017 17:24
-
-
Save Splode/735c7e565ecbe87d875f8c892847be9b to your computer and use it in GitHub Desktop.
Pre-load images for faster painting of new 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
// example imgObj | |
const img = { | |
filename: 'example.jpg', | |
caption: 'example-caption' | |
} | |
function preloadImgs (imageLs) { | |
imageLs.forEach(imgObj => { | |
let img = new Image() | |
img.src = imgObj.filename | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment