Created
May 10, 2020 01:30
-
-
Save zackify/266d6fe5eddc1d00938cbda4d37b40ec to your computer and use it in GitHub Desktop.
Example loading module vs no module
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
(function(d) { | |
var script = d.createElement("script"); | |
script.type = "text/javascript"; | |
script.text = | |
'import("https://passwordless.app/account/module/integrated.js");window.supportsDynamicImport = true;'; | |
d.getElementsByTagName("head")[0].appendChild(script); | |
var script2 = d.createElement("script"); | |
script2.type = "text/javascript"; | |
script2.text = | |
'if (!window.supportsDynamicImport) {const systemJsLoaderTag = document.createElement("script");systemJsLoaderTag.src = "https://unpkg.com/[email protected]/dist/s.min.js";systemJsLoaderTag.addEventListener("load", function() {System.import("https://passwordless.app/account/nomodule/integrated.js");});document.head.appendChild(systemJsLoaderTag);}'; | |
d.getElementsByTagName("head")[0].appendChild(script2); | |
var link = d.createElement("link"); | |
link.rel = "stylesheet"; | |
link.type = "text/css"; | |
link.href = "https://passwordless.app/fonts/fonts.css"; | |
d.getElementsByTagName("head")[0].appendChild(link); | |
})(document); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment