refactor
This commit is contained in:
parent
e60bb12707
commit
5ca83ba7ba
24 changed files with 144 additions and 137 deletions
13
1-js/11-async/05-promise-api/head.html
Normal file
13
1-js/11-async/05-promise-api/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