@jcm/use-pusher
Version:
Fork of harelpls/use-pusher with the latest changes on master
11 lines (10 loc) • 438 B
TypeScript
import { Channel, PresenceChannel } from "pusher-js";
/**
* Subscribes to a channel event and registers a callback.
* @param channel Pusher channel to bind to
* @param eventName Name of event to bind to
* @param callback Callback to call on a new event
*/
export declare function useEvent<D>(channel: Channel | PresenceChannel | undefined, eventName: string, callback: (data?: D, metadata?: {
user_id: string;
}) => void): void;