refactoring, modules
This commit is contained in:
parent
b8f6d96990
commit
a16814aaf1
112 changed files with 484 additions and 1825 deletions
13
1-js/09-async/02-promise-basics/head.html
Normal file
13
1-js/09-async/02-promise-basics/head.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<script>
|
||||
function loadScript(src) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
let script = document.createElement('script');
|
||||
script.src = src;
|
||||
|
||||
script.onload = () => resolve(script);
|
||||
script.onerror = () => reject(new Error("Script load error: " + src));
|
||||
|
||||
document.head.append(script);
|
||||
});
|
||||
}
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue