File size: 417 Bytes
27bb457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

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);
  }
}