Created
February 14, 2013 12:46
-
-
Save atleastimtrying/4952530 to your computer and use it in GitHub Desktop.
preloading an image in Coffeescript
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
src = 'whatever.png' | |
img = document.createElement 'img' | |
img.src = whatever | |
img.onload = -> | |
console.log 'img loaded' | |
document.body.appendChild img |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment