Created
June 11, 2020 09:04
-
-
Save pxlrbt/eb1a11a7d037b2c366bd55d9ad5352e4 to your computer and use it in GitHub Desktop.
Revisions
-
pxlrbt revised this gist
Jun 11, 2020 . No changes.There are no files selected for viewing
-
pxlrbt created this gist
Jun 11, 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,7 @@ import waitForPolyfills from '@/polyfill/polyfill-helper'; waitForPolyfills(main); function main() { // ... } 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,30 @@ /** * Check for needed function and load polyfills in case */ function waitForPolyfills(entry) { if ('assign' in Object) { return entry(); } console.log('Load Polyfills', window.polyfill_uri); return loadScript(window.polyfill_uri, entry); } /** * Load a script ressource and execute callback afterwards */ function loadScript(src, callback) { var js = document.createElement('script'); js.src = src; js.onload = function() { callback(callback); }; js.onerror = function() { callback(callback); }; document.head.appendChild(js); } export default waitForPolyfills;