@jcm/use-pusher
Version:
Fork of harelpls/use-pusher with the latest changes on master
16 lines (15 loc) • 752 B
TypeScript
/**
* Hook to provide a trigger function that calls the server defined in `PusherProviderProps.triggerEndpoint` using `fetch`.
* Any `auth?.headers` in the config object will be passed with the `fetch` call.
*
* @param channelName name of channel to call trigger on
* @typeparam TData shape of the data you're sending with the event
*
* @example
* ```typescript
* const trigger = useTrigger<{message: string}>('my-channel');
* trigger('my-event', {message: 'hello'});
* ```
*/
export declare function useTrigger<TData = {}>(channelName: string): (eventName: string, data?: TData) => Promise<Response>;
export declare const NO_AUTH_HEADERS_WARNING = "No auth parameters supplied to <PusherProvider />. Your events will be unauthenticated.";