Skip to content

Instantly share code, notes, and snippets.

@Splode
Last active November 20, 2017 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Splode/735c7e565ecbe87d875f8c892847be9b to your computer and use it in GitHub Desktop.
Save Splode/735c7e565ecbe87d875f8c892847be9b to your computer and use it in GitHub Desktop.
Pre-load images for faster painting of new images
// 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