Created
March 22, 2017 14:18
-
-
Save nash403/a069b80aee3f563e20ed6b22b0ea07f5 to your computer and use it in GitHub Desktop.
Preload images in JS
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
let img = new Image(); | |
img.onload = () => { | |
console.log('youpiiii img preloaded !') | |
}; | |
img.src = 'some_url'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment