evently-react
Version:
A Hook-Based Framework for Event-Driven React Apps
9 lines (8 loc) • 446 B
TypeScript
import { Events } from '../types';
/**
* useSubscribe hook to listen for one or multiple events.
* @param eventNames The name(s) of the events to subscribe to.
* @param callback The callback function to handle the event(s).
* @param priority The priority of the subscription.
*/
export declare function useSubscribe<E extends keyof Events>(eventNames: E | E[], callback: (eventName: E, payload: Events[E]) => void, priority?: number): void;