<script lang="ts">
    import GameStateSvelte from "$lib/GameState.svelte";
    import ws from "$lib/websocket.svelte";
    let { children } = $props();

    $effect(() => {
        if (ws.messageNum <= 0) return;
        console.log(ws.message);
        if (ws.message == "DISPLAY-CONNECTED") {
            GameStateSvelte.displayConnected = true;
            ws.nextMessage();
        } else if (ws.message == "DISPLAY-DISCONNECTED") {
            GameStateSvelte.displayConnected = false;
            ws.nextMessage();
        }
    });
</script>

{@render children?.()}
