diff --git a/demo/src/html/index.html.template b/demo/src/html/index.html.template index dc3d4994e2..0b045fddd8 100644 --- a/demo/src/html/index.html.template +++ b/demo/src/html/index.html.template @@ -5,18 +5,6 @@ - - <%= renderTemplate('_js_base') %> + <%= renderTemplate('_preload_roboto') %> diff --git a/src/entrypoints/core.ts b/src/entrypoints/core.ts index dc2ee49e8b..8a6bedf9db 100644 --- a/src/entrypoints/core.ts +++ b/src/entrypoints/core.ts @@ -28,6 +28,7 @@ import { HomeAssistant } from "../types"; declare global { interface Window { hassConnection: Promise<{ auth: Auth; conn: Connection }>; + hassConnectionReady?: (hassConnection: Window["hassConnection"]) => void; } } @@ -82,6 +83,11 @@ window.hassConnection = (authProm() as Promise).then( connProm ); +// This is set if app was somehow loaded before core. +if (window.hassConnectionReady) { + window.hassConnectionReady(window.hassConnection); +} + // Start fetching some of the data that we will need. window.hassConnection.then(({ conn }) => { const noop = () => { diff --git a/src/html/_preload_roboto.html.template b/src/html/_preload_roboto.html.template new file mode 100644 index 0000000000..6ac777eb8e --- /dev/null +++ b/src/html/_preload_roboto.html.template @@ -0,0 +1,16 @@ + diff --git a/src/html/authorize.html.template b/src/html/authorize.html.template index f57c709147..3cbcfda5ce 100644 --- a/src/html/authorize.html.template +++ b/src/html/authorize.html.template @@ -3,18 +3,6 @@ Home Assistant - - <%= renderTemplate('_header') %>