/* eslint-disable @typescript-eslint/no-empty-object-type */// Define Liveblocks types for your application// https://liveblocks.io/docs/api-reference/liveblocks-react#Typing-your-dataimport {createClient,LiveList,LiveMap,LiveObject,} from "@liveblocks/client";import { createRoomContext } from "@liveblocks/react";import { Layer, Color } from "@/type/Canvas";const client = createClient({throttle: 16,// publicApiKey: process.env.NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_KEY!,authEndpoint: "/api/liveblocks-auth",});// type Presence = {// cursor: { x: number; y: number } | null;// };export const {RoomProvider,useOthers,useUpdateMyPresence,useOthersConnectionIds,} = createRoomContext<Liveblocks["Presence"]>(client);// createRoomContext<Liveblocks["Presence"]>(client);declare global {interface Liveblocks {// Each user's Presence, for useMyPresence, useOthers, etc.Presence: {// Example, real-time cursor coordinatescursor: { x: number; y: number } | null;selection: string[];penciDraft: [x: number, y: number, pressure: number][] | null;penColor: Color | null;};// The Storage tree for the room, for useMutation, useStorage, etc.Storage: {// Example, a conflict-free list// animals: LiveList<string>;layers: LiveMap<string, LiveObject<Layer>>;layerIds: LiveList<string>;};// Custom user info set when authenticating with a secret keyUserMeta: {id: string;info: {name?: string;picture?: string;};};// Custom events, for useBroadcastEvent, useEventListenerRoomEvent: {};// 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 useRoomInfoRoomInfo: {// Example, rooms with a title and url// title: string;// url: string;};}}export { client };
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。