aboutsummaryrefslogtreecommitdiff
path: root/web/pw-frontend/src/lib/Visualizer.svelte
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2021-12-25 20:28:10 +0100
committerIlion Beyst <ilion.beyst@gmail.com>2021-12-25 20:28:10 +0100
commit003c551e7320912d468b00905da234ad262b5446 (patch)
treebcdc9da9c05790674265237ffb2a6fb12411c2ea /web/pw-frontend/src/lib/Visualizer.svelte
parent92a13bac9289fd00a6fa2c70129490fa22ef0661 (diff)
downloadplanetwars.dev-003c551e7320912d468b00905da234ad262b5446.tar.xz
planetwars.dev-003c551e7320912d468b00905da234ad262b5446.zip
implement basic MatchBrowser component
Diffstat (limited to 'web/pw-frontend/src/lib/Visualizer.svelte')
-rw-r--r--web/pw-frontend/src/lib/Visualizer.svelte18
1 files changed, 15 insertions, 3 deletions
diff --git a/web/pw-frontend/src/lib/Visualizer.svelte b/web/pw-frontend/src/lib/Visualizer.svelte
index 35b0677..297659c 100644
--- a/web/pw-frontend/src/lib/Visualizer.svelte
+++ b/web/pw-frontend/src/lib/Visualizer.svelte
@@ -2,12 +2,24 @@
import { onMount } from 'svelte';
import * as visualizer from '../lib/visualizer/index';
+ export let matchLog = null;
+
+ let initialized = false;
+
onMount(() => {
visualizer.init();
- fetch("match.log")
- .then(response => response.text())
- .then(data => visualizer.set_instance(data));
+ initialized = true;
+ visualizer.set_loading(false);
});
+
+ $: if (initialized) {
+ if (matchLog === null) {
+ visualizer.set_loading(true);
+ } else {
+ visualizer.set_instance(matchLog);
+ visualizer.set_loading(false);
+ }
+ }
</script>
<div id="main" class="loading">