Last active
June 8, 2020 21:40
-
-
Save felquis/0473dfdb355e362ceb5a67097a0934f5 to your computer and use it in GitHub Desktop.
Revisions
-
felquis revised this gist
Jun 8, 2020 . 1 changed file with 14 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,18 @@ /* Usage: loadJavaScriptFiles([{ href: 'https://path-to', }, { href: 'https://unpkg.com/cdn-path-to', integrity: 'sha384', }, { href: 'https://unpkg.com/path-to', }, ]) */ const loadJavaScriptFiles = list => { return Promise.all( -
felquis revised this gist
Jun 8, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ /* Usage: loadJavaScriptFiles([{ src: 'cdn-path-to-file' }]) */ const loadJavaScriptFiles = list => { return Promise.all( -
felquis created this gist
Jun 8, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ /* Usage: loadJavaScriptFiles({ giveItAName: 'cdn-path-to-file' }) */ const loadJavaScriptFiles = list => { return Promise.all( list.map(file => { return new Promise((resolve, reject) => { const script = document.createElement('script'); Object.keys(file).forEach(propertyName => { script[propertyName] = file[propertyName]; }); script.onload = () => resolve(); script.onerror = () => reject(); document.body.appendChild(script); }); }) ); }; module exports loadJavaScriptFiles