@supunlakmal/hooks
Version:
A collection of reusable React hooks
11 lines (10 loc) • 396 B
TypeScript
/**
* Enables cross-tab/window communication between same-origin contexts using the Broadcast Channel API.
*
* @param channelName The name of the broadcast channel.
* @returns An object containing the received data and a function to post messages.
*/
export declare const useBroadcastChannel: <T = any>(channelName: string) => {
data: T | null;
postMessage: (message: T) => void;
};