Last active
March 6, 2020 18:21
-
-
Save undrafted/e2f4f40339d3271eac42fe5585f9b58f to your computer and use it in GitHub Desktop.
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
export const preloadImage = (url: string) => { | |
return new Promise(resolve => { | |
const img = document.createElement('img'); | |
img.src = url; | |
img.onload = () => resolve(src); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment