tasko/liveblocks.config.ts

71 lines
1.5 KiB
TypeScript

import { createClient } from "@liveblocks/client";
import { createRoomContext, createLiveblocksContext } from "@liveblocks/react";
const client = createClient({
publicApiKey: process.env.NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_KEY!,
throttle: 16,
});
type Presence = {
cursor: { x: number; y: number } | null;
};
type Storage = {};
type UserMeta = {};
type RoomEvent = {};
export type ThreadMetadata = {};
export const {
suspense: {
RoomProvider,
useRoom,
useMyPresence,
useUpdateMyPresence,
useSelf,
useOthers,
useOthersMapped,
useOthersListener,
useOthersConnectionIds,
useOther,
useBroadcastEvent,
useEventListener,
useErrorListener,
useStorage,
useBatch,
useHistory,
useUndo,
useRedo,
useCanUndo,
useCanRedo,
useMutation,
useStatus,
useLostConnectionListener,
useThreads,
useCreateThread,
useEditThreadMetadata,
useCreateComment,
useEditComment,
useDeleteComment,
useAddReaction,
useRemoveReaction,
useThreadSubscription,
useMarkThreadAsRead,
useRoomNotificationSettings,
useUpdateRoomNotificationSettings,
}
} = createRoomContext<Presence, Storage, UserMeta, RoomEvent, ThreadMetadata>(client);
export const {
suspense: {
LiveblocksProvider,
useMarkInboxNotificationAsRead,
useMarkAllInboxNotificationsAsRead,
useInboxNotifications,
useUnreadInboxNotificationsCount,
useUser,
useRoomInfo,
}
} = createLiveblocksContext<UserMeta, ThreadMetadata>(client);