-
Notifications
You must be signed in to change notification settings - Fork 0
/
liveblocks.config.ts
56 lines (48 loc) · 1.58 KB
/
liveblocks.config.ts
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
49
50
51
52
53
54
55
56
// Define Liveblocks types for your application
import { Color, Layer } from "@/types/canvas";
import type { LiveList, LiveMap, LiveObject } from "@liveblocks/client";
// https://liveblocks.io/docs/api-reference/liveblocks-react#Typing-your-data
declare global {
interface Liveblocks {
// Each user's Presence, for useMyPresence, useOthers, etc.
Presence: {
// Example, real-time cursor coordinates
cursor: { x: number; y: number } | null;
selection: string[];
pencilDraft: [x: number, y: number, pressure: number][] | null;
penColor: Color | null;
};
// The Storage tree for the room, for useMutation, useStorage, etc.
Storage: {
layers: LiveMap<string, LiveObject<Layer>>;
layerIds: LiveList<string>;
};
// Custom user info set when authenticating with a secret key
UserMeta: {
id: string;
info: {
// Example properties, for useSelf, useUser, useOthers, etc.
name: string;
image: string;
};
};
// Custom events, for useBroadcastEvent, useEventListener
RoomEvent: {};
// Example has two events, using a union
// | { type: "PLAY" }
// | { type: "REACTION"; emoji: "🔥" };
// Custom metadata set on threads, for useThreads, useCreateThread, etc.
ThreadMetadata: {
// Example, attaching coordinates to a thread
// x: number;
// y: number;
};
// Custom room info set with resolveRoomsInfo, for useRoomInfo
RoomInfo: {
// Example, rooms with a title and url
// title: string;
// url: string;
};
}
}
export {};