From a5b8f093a64ae574b557003f33c7ebe88ea9809d Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Mon, 7 Jun 2021 15:11:29 +0000 Subject: [PATCH] Make preload accessible --- src/install-button.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/install-button.ts b/src/install-button.ts index bc0be93..144adac 100644 --- a/src/install-button.ts +++ b/src/install-button.ts @@ -7,6 +7,10 @@ class InstallButton extends HTMLElement { private renderRoot?: ShadowRoot; + public static preload() { + import("./start-flash"); + } + public connectedCallback() { if (this.renderRoot) { return; @@ -22,10 +26,7 @@ class InstallButton extends HTMLElement { } this.setAttribute("install-supported", ""); - this.addEventListener("mouseover", () => { - // Preload - import("./start-flash"); - }); + this.addEventListener("mouseover", InstallButton.preload); this.addEventListener("click", async (ev) => { ev.preventDefault(); const manifest = this.manifest || this.getAttribute("manifest");