mirror of
https://github.com/jlengrand/open-wc.git
synced 2026-03-10 08:31:19 +00:00
28 lines
669 B
JavaScript
28 lines
669 B
JavaScript
(function () {
|
|
function loadScript(src, type) {
|
|
return new Promise(function (resolve) {
|
|
var script = document.createElement('script');
|
|
|
|
function onLoaded() {
|
|
if (script.parentElement) {
|
|
script.parentElement.removeChild(script);
|
|
}
|
|
|
|
resolve();
|
|
}
|
|
|
|
script.src = src;
|
|
script.onload = onLoaded;
|
|
|
|
script.onerror = function () {
|
|
console.error('[polyfills-loader] failed to load: ' + src + ' check the network tab for HTTP status.');
|
|
onLoaded();
|
|
};
|
|
|
|
if (type) script.type = type;
|
|
document.head.appendChild(script);
|
|
});
|
|
}
|
|
|
|
loadScript('/app.js', 'module');
|
|
})(); |