react-event-injector
Version:
React way to addEventListener
12 lines (11 loc) • 564 B
TypeScript
declare type Callback = (name: string, cb: any, options: AddEventListenerOptions, settings: AddEventListenerOptions) => any;
export interface CallEvent {
name: string;
cb: any;
options: boolean | AddEventListenerOptions;
}
export declare function getEventNames<T extends object>(names: T): Array<keyof T>;
export declare const forEventsIn: (events: CallEvent[], cb: Callback) => void;
export declare const attach: (ref: EventTarget, events: CallEvent[]) => void;
export declare const detach: (ref: EventTarget, events: CallEvent[]) => void;
export {};