trifid/tfweb/src/components/LoadingWrapper.svelte

30 lines
585 B
Svelte
Raw Normal View History

2023-05-31 01:51:57 +00:00
<script lang="ts">
2023-05-31 17:24:15 +00:00
import {logDeltaReset, Logger, logSetup} from "$lib/logger";
2023-05-31 01:51:57 +00:00
export let isLoading;
export let isError;
export let error;
logSetup();
let logger = new Logger("LoadingWrapper.svelte");
function loadingproclog() {
if (!isLoading) {
logger.info("page loaded - content paint");
2023-05-31 17:24:15 +00:00
logDeltaReset();
2023-05-31 01:51:57 +00:00
}
}
$: isLoading, loadingproclog();
</script>
{#if isLoading}
<h1>its loading</h1>
{:else}
{#if isError}
<h1>error: {error}</h1>
{:else}
<slot></slot>
{/if}
{/if}