<script lang="ts">
    import {logDeltaReset, Logger, logSetup} from "$lib/logger";

    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");
            logDeltaReset();
        }
    }

    $: isLoading, loadingproclog();
</script>

{#if isLoading}
    <h1>its loading</h1>
{:else}
    {#if isError}
        <h1>error: {error}</h1>
    {:else}
        <slot></slot>
    {/if}
{/if}
