Only load ES6 module loader polyfill if needed

Safari now has native support for modules, so we need to make sure
we only load our polyfill when actually needed.
This commit is contained in:
Pierre Ossman 2017-04-28 14:38:59 +02:00
parent 0613d18894
commit 36bdf13654
1 changed files with 13 additions and 1 deletions

View File

@ -65,7 +65,19 @@
<!-- begin scripts -->
<!-- promise polyfills promises for IE11 -->
<script src="vendor/promise.js"></script>
<script src="vendor/browser-es-module-loader/dist/browser-es-module-loader.js"></script>
<!-- ES2015/ES6 modules polyfill -->
<script type="module">
window._noVNC_has_module_support = true;
</script>
<script>
window.addEventListener("load", function() {
if (window._noVNC_has_module_support) return;
var loader = document.createElement("script");
loader.src = "vendor/browser-es-module-loader/dist/browser-es-module-loader.js";
document.head.appendChild(loader);
});
</script>
<!-- actual script modules -->
<script type="module" src="app/ui.js"></script>
<!-- end scripts -->
</head>