blob: 488312f86efd0360488ef075cbd84230fbc59c55 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<script lang="ts">
import page from "page";
import { onMount } from "svelte";
import type { Component, ComponentProps } from "svelte";
import Home from "./pages/Home.svelte";
let CurrentPage: Component<any> | null = $state(null);
let currentPageProps: any = $state({});
function bindComponent<T extends Component<any>>(
component: T,
props: ComponentProps<T>,
) {
CurrentPage = component;
currentPageProps = props;
}
onMount(() => {
page("/", () => {
bindComponent(Home, {});
});
page.start();
});
</script>
<main>
{#if CurrentPage}
<CurrentPage {...currentPageProps}></CurrentPage>
{:else}
<p>No page bound</p>
{/if}
</main>
|