From 21e36261c6ba2f6ad0cadb2b4fec21d84f2fa68c Mon Sep 17 00:00:00 2001 From: Steve Repsher Date: Wed, 18 Oct 2023 17:07:44 +0000 Subject: [PATCH] Load and set Polymer settings asynchronously --- hassio/src/entrypoint.ts | 6 +++--- src/entrypoints/app.ts | 13 ++++++------- src/entrypoints/authorize.ts | 6 +++--- src/entrypoints/custom-panel.ts | 5 +++-- src/entrypoints/onboarding.ts | 6 +++--- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/hassio/src/entrypoint.ts b/hassio/src/entrypoint.ts index fab7f7a776a6..35a7e8647b13 100644 --- a/hassio/src/entrypoint.ts +++ b/hassio/src/entrypoint.ts @@ -1,12 +1,12 @@ // Compat needs to be first import import "../../src/resources/compatibility"; -import { setCancelSyntheticClickEvents } from "@polymer/polymer/lib/utils/settings"; import "../../src/resources/safari-14-attachshadow-patch"; import "./hassio-main"; import("../../src/resources/ha-style"); - -setCancelSyntheticClickEvents(false); +import("@polymer/polymer/lib/utils/settings").then( + ({ setCancelSyntheticClickEvents }) => setCancelSyntheticClickEvents(false) +); const styleEl = document.createElement("style"); styleEl.textContent = ` diff --git a/src/entrypoints/app.ts b/src/entrypoints/app.ts index 283207a51e33..21230d7cb60d 100644 --- a/src/entrypoints/app.ts +++ b/src/entrypoints/app.ts @@ -1,11 +1,10 @@ -import { - setPassiveTouchGestures, - setCancelSyntheticClickEvents, -} from "@polymer/polymer/lib/utils/settings"; import "@webcomponents/scoped-custom-element-registry/scoped-custom-element-registry.min"; import "../layouts/home-assistant"; import("../resources/ha-style"); - -setPassiveTouchGestures(true); -setCancelSyntheticClickEvents(false); +import("@polymer/polymer/lib/utils/settings").then( + ({ setCancelSyntheticClickEvents, setPassiveTouchGestures }) => { + setCancelSyntheticClickEvents(false); + setPassiveTouchGestures(true); + } +); diff --git a/src/entrypoints/authorize.ts b/src/entrypoints/authorize.ts index c2fa3dae456d..e26b398e7a4e 100644 --- a/src/entrypoints/authorize.ts +++ b/src/entrypoints/authorize.ts @@ -1,10 +1,10 @@ // Compat needs to be first import import "../resources/compatibility"; -import { setCancelSyntheticClickEvents } from "@polymer/polymer/lib/utils/settings"; import "../auth/ha-authorize"; import "../resources/safari-14-attachshadow-patch"; import "../resources/array.flat.polyfill"; import("../resources/ha-style"); - -setCancelSyntheticClickEvents(false); +import("@polymer/polymer/lib/utils/settings").then( + ({ setCancelSyntheticClickEvents }) => setCancelSyntheticClickEvents(false) +); diff --git a/src/entrypoints/custom-panel.ts b/src/entrypoints/custom-panel.ts index fbfb0866f51c..5f5866f46c77 100644 --- a/src/entrypoints/custom-panel.ts +++ b/src/entrypoints/custom-panel.ts @@ -1,6 +1,5 @@ // Compat needs to be first import import "../resources/compatibility"; -import { setCancelSyntheticClickEvents } from "@polymer/polymer/lib/utils/settings"; import "../resources/safari-14-attachshadow-patch"; import { PolymerElement } from "@polymer/polymer"; @@ -16,7 +15,9 @@ import { createCustomPanelElement } from "../util/custom-panel/create-custom-pan import { loadCustomPanel } from "../util/custom-panel/load-custom-panel"; import { setCustomPanelProperties } from "../util/custom-panel/set-custom-panel-properties"; -setCancelSyntheticClickEvents(false); +import("@polymer/polymer/lib/utils/settings").then( + ({ setCancelSyntheticClickEvents }) => setCancelSyntheticClickEvents(false) +); declare global { interface Window { diff --git a/src/entrypoints/onboarding.ts b/src/entrypoints/onboarding.ts index 014b4571c15f..3d1ea415474d 100644 --- a/src/entrypoints/onboarding.ts +++ b/src/entrypoints/onboarding.ts @@ -1,13 +1,13 @@ // Compat needs to be first import import "../resources/compatibility"; -import { setCancelSyntheticClickEvents } from "@polymer/polymer/lib/utils/settings"; import "../onboarding/ha-onboarding"; import "../resources/safari-14-attachshadow-patch"; import "../resources/array.flat.polyfill"; import("../resources/ha-style"); - -setCancelSyntheticClickEvents(false); +import("@polymer/polymer/lib/utils/settings").then( + ({ setCancelSyntheticClickEvents }) => setCancelSyntheticClickEvents(false) +); declare global { interface Window {