Last active
July 28, 2019 13:50
-
-
Save livelikeabel/969d377e709fbda5c3565df1b2aaff86 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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Document</title> | |
| </head> | |
| <body> | |
| <button id="btn" onclick="myLoader()">submit</button> | |
| <script> | |
| function scriptLoader(src) { | |
| const el = document.createElement('script'); | |
| el.type = 'text/javascript'; | |
| el.src = src; | |
| document.body.appendChild(el); | |
| return new Promise((resolve, reject) => { | |
| el.onload = () => resolve('Successful script loading'); | |
| el.onerror = () => reject(new Error(`Not loaded script '${src}'`)); | |
| }); | |
| }; | |
| scriptLoader("https://unpkg.com/react@16/umd/react.development.js") | |
| .then(res => console.log('succes!', res)) | |
| .catch(err => console.log(err)) | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment