File size: 1,255 Bytes
142f91b
70b8e47
73e6846
70b8e47
73e6846
70b8e47
560b99e
70b8e47
66ed450
70b8e47
 
1d701d3
70b8e47
 
 
66ed450
70b8e47
 
 
 
 
 
73e6846
304976c
7cb7420
 
 
73e6846
1d701d3
73e6846
70b8e47
 
 
1d701d3
70b8e47
 
 
142f91b
 
e5b9b7e
35946a9
 
 
142f91b
35946a9
 
 
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<script lang="ts">
	import { onMount } from 'svelte';
	import { isLoading, loadingState, createPresenceStore, createStorageStore } from '$lib/store';
	import type { Client, Room } from '@liveblocks/client';
	import { createClient, LiveList } from '@liveblocks/client';

	import App from '$lib/App.svelte';
	import type { Presence, Storage } from '$lib/types';

	let client: Client;
	let room: Room;
	let roomId = 'multiplayer-SD';

	onMount(() => {
		client = createClient({
			publicApiKey: 'pk_test_JlUZGH3kQmhmZQiqU2l8eIi5'
		});

		room = client.enter<Presence, Storage /* UserMeta, RoomEvent */>(roomId, {
			initialPresence: {
				cursor: null
			},
			initialStorage: { imagesList: new LiveList() }
		});
		const unsubscribe = room.subscribe('error', (error) => {
			console.error('error', error);
		});

		const unsubscribePresence = createPresenceStore(room);
		createStorageStore(room);
		return () => {
			if (client && room) {
				client.leave(roomId);
				unsubscribePresence();
			}
		};
	});
</script>

<div class="max-w-screen-md mx-auto p-5 relative pointer-events-none touch-none z-10">
	<h1 class="text-lg md:text-3xl font-bold leading-normal">
		Stable Diffussion Outpainting Multiplayer
	</h1>
</div>
{#if room}
	<App {room} />
{/if}