-
-
Save IPRIT/9ea5273a7865c75f41d87d773df37844 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
| function loadImage (url) { | |
| return new Promise((resolve, reject) => { | |
| let img = new Image(); | |
| img.addEventListener('load', _ => { | |
| resolve(img) | |
| }); | |
| img.addEventListener('error', _ => { | |
| reject(_) | |
| }); | |
| img.src = url; | |
| }); | |
| } | |
| loadImage('https://yastatic.net/www/_/x/Q/xk8YidkhGjIGOrFm_dL5781YA.svg').then(img => { | |
| document.body.appendChild( img ); | |
| }).catch( console.log ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment