ejfox's picture
Duplicate from huggingface-projects/stable-diffusion-multiplayer
bb88c4d
raw
history blame
417 Bytes
import { useRoom } from "./useRoom";
import type { Json, BroadcastOptions } from "@liveblocks/client";
export function useBroadcastEvent<TRoomEvent extends Json>(): (
event: TRoomEvent,
options?: BroadcastOptions
) => void {
const room = useRoom();
return (
event: TRoomEvent,
options: BroadcastOptions = { shouldQueueEventIfNotReady: false }
) => {
room.broadcastEvent(event, options);
}
}