Skip to content

Instantly share code, notes, and snippets.

@bouveng
Created August 29, 2020 21:42
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 bouveng/81a6e2e36ba2d10850105b09da41a39a to your computer and use it in GitHub Desktop.
Save bouveng/81a6e2e36ba2d10850105b09da41a39a to your computer and use it in GitHub Desktop.
loadImage.js
export function loadImage(url) {
return new Promise(resolve => {
const image = new Image();
image.addEventListener('load', () => {
resolve(image);
});
image.src = url;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment