mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-25 13:57:21 +00:00
Fix custom panel paths (#3188)
This commit is contained in:
parent
9340d9068e
commit
5501cccc67
2
src/common/feature-detect/support-web-components.ts
Normal file
2
src/common/feature-detect/support-web-components.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export const webComponentsSupported =
|
||||
"customElements" in window && "content" in document.createElement("template");
|
@ -5,6 +5,7 @@ import { setCustomPanelProperties } from "../util/custom-panel/set-custom-panel-
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
import { PolymerElement } from "@polymer/polymer";
|
||||
import { CustomPanelInfo } from "../data/panel_custom";
|
||||
import { webComponentsSupported } from "../common/feature-detect/support-web-components";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
@ -12,18 +13,13 @@ declare global {
|
||||
}
|
||||
}
|
||||
|
||||
const webComponentsSupported =
|
||||
"customElements" in window &&
|
||||
"import" in document.createElement("link") &&
|
||||
"content" in document.createElement("template");
|
||||
|
||||
let es5Loaded: Promise<unknown> | undefined;
|
||||
|
||||
window.loadES5Adapter = () => {
|
||||
if (!es5Loaded) {
|
||||
es5Loaded = Promise.all([
|
||||
loadJS(
|
||||
`${__STATIC_PATH__}/polyfills/custom-elements-es5-adapter.js`
|
||||
`${__STATIC_PATH__}polyfills/custom-elements-es5-adapter.js`
|
||||
).catch(),
|
||||
import(/* webpackChunkName: "compat" */ "./compatibility"),
|
||||
]);
|
||||
@ -50,7 +46,7 @@ function initialize(panel: CustomPanelInfo, properties: {}) {
|
||||
|
||||
if (!webComponentsSupported) {
|
||||
start = start.then(() =>
|
||||
loadJS(`${__STATIC_PATH__}/polyfills/webcomponents-bundle.js`)
|
||||
loadJS(`${__STATIC_PATH__}polyfills/webcomponents-bundle.js`)
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user