radames's picture
adding new hooks
27bb457
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);
}
}