From 186cd0b777fed6988027c3fbe8747025ee6a7791 Mon Sep 17 00:00:00 2001
From: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
Date: Thu, 8 Oct 2020 06:13:46 +0000
Subject: [PATCH] Loading component
---
ui/src/app/LoadingApp.svelte | 10 ++++++++++
ui/src/app/main.js | 10 ++++++++++
2 files changed, 20 insertions(+)
create mode 100644 ui/src/app/LoadingApp.svelte
diff --git a/ui/src/app/LoadingApp.svelte b/ui/src/app/LoadingApp.svelte
new file mode 100644
index 0000000..ecf2d0b
--- /dev/null
+++ b/ui/src/app/LoadingApp.svelte
@@ -0,0 +1,10 @@
+
+
+
diff --git a/ui/src/app/main.js b/ui/src/app/main.js
index 3b27e31..7cd3c86 100644
--- a/ui/src/app/main.js
+++ b/ui/src/app/main.js
@@ -9,8 +9,14 @@ import {wasm} from './stores'
// Svelte app
import App from './App.svelte'
+import LoadingApp from './LoadingApp.svelte'
;(async function main() {
+ // Show the LoadingApp component while the app is initializing
+ const loading = new LoadingApp({
+ target: document.body,
+ })
+
// Register the service worker and wait for its activation
try {
await navigator.serviceWorker.register('sw.js')
@@ -25,8 +31,12 @@ import App from './App.svelte'
console.error('Service worker registration failed with ' + err)
}
+ // Force-enable Wasm in development
await enableWasm(true)
+ // Remove the loading component
+ loading.$destroy()
+
// Initialize the Svelte app and inject it in the DOM
new App({
target: document.body,