Move compatibility to the top of custom panel entrypoint (#6055)

This commit is contained in:
Paulus Schoutsen 2020-05-27 00:19:28 -07:00 committed by GitHub
parent 3a5bd7474b
commit 5cb7117656
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,4 @@
import "../resources/compatibility";
import { PolymerElement } from "@polymer/polymer"; import { PolymerElement } from "@polymer/polymer";
import { fireEvent } from "../common/dom/fire_event"; import { fireEvent } from "../common/dom/fire_event";
import { loadJS } from "../common/dom/load_resource"; import { loadJS } from "../common/dom/load_resource";
@ -17,12 +18,9 @@ let es5Loaded: Promise<unknown> | undefined;
window.loadES5Adapter = () => { window.loadES5Adapter = () => {
if (!es5Loaded) { if (!es5Loaded) {
es5Loaded = Promise.all([ es5Loaded = loadJS(
loadJS( `${__STATIC_PATH__}polyfills/custom-elements-es5-adapter.js`
`${__STATIC_PATH__}polyfills/custom-elements-es5-adapter.js` ).catch(); // Swallow errors as it raises errors on old browsers.
).catch(),
import(/* webpackChunkName: "compat" */ "../resources/compatibility"),
]);
} }
return es5Loaded; return es5Loaded;
}; };
@ -51,7 +49,6 @@ function initialize(panel: CustomPanelInfo, properties: {}) {
} }
if (__BUILD__ === "es5") { if (__BUILD__ === "es5") {
// Load ES5 adapter. Swallow errors as it raises errors on old browsers.
start = start.then(() => window.loadES5Adapter()); start = start.then(() => window.loadES5Adapter());
} }