@jcm/use-pusher
Version:
Fork of harelpls/use-pusher with the latest changes on master
16 lines (15 loc) • 683 B
TypeScript
import { Channel, PresenceChannel } from "pusher-js";
/**
*
* @param channel the channel you'd like to trigger clientEvents on. Get this from [[useChannel]] or [[usePresenceChannel]].
* @typeparam TData shape of the data you're sending with the event.
* @returns A memoized trigger function that will perform client events on the channel.
* @example
* ```javascript
* const channel = useChannel('my-channel');
* const trigger = useClientTrigger(channel)
*
* const handleClick = () => trigger('some-client-event', {});
* ```
*/
export declare function useClientTrigger<TData = {}>(channel: Channel | PresenceChannel | undefined): (eventName: string, data: TData) => void;