@jcm/use-pusher
Version:
Fork of harelpls/use-pusher with the latest changes on master
16 lines (15 loc) • 609 B
TypeScript
import { Channel, PresenceChannel } from "pusher-js";
/**
* Subscribe to a channel
*
* @param channelName The name of the channel you want to subscribe to.
* @typeparam Type of channel you're subscribing to. Can be one of `Channel` or `PresenceChannel` from `pusher-js`.
* @returns Instance of the channel you just subscribed to.
*
* @example
* ```javascript
* const channel = useChannel("my-channel")
* channel.bind('some-event', () => {})
* ```
*/
export declare function useChannel<T extends Channel & PresenceChannel>(channelName: string | undefined): (Channel & PresenceChannel) | undefined;