rooks
Version:
Essential React custom hooks ⚓ to super charge your components!
32 lines • 1.14 kB
TypeScript
import type { MutableRefObject } from "react";
declare type Options = {
/**
* should the event logging be continuous
*/
continuous?: boolean;
/**
* target ref on which the events should be listened. If no target is specified,
* events are listened to on the document
*/
target?: MutableRefObject<Document> | MutableRefObject<HTMLElement | null>;
/**
* when boolean to enable and disable events, when passed false
* remove the eventlistener if any
*/
when?: boolean;
/**
* opt-in to prevent alert, confirm and prompt from causing the eventlistener to lose track of keyup events.
*/
preventLostKeyup?: boolean;
};
/**
* useKeys hook
*
* @param keysList - list of keys to listen to
* @param callback - callback to be called when a key is pressed
* @param options - options to be passed to the event listener
* @see https://react-hooks.org/docs/useKeys
*/
declare function useKeys(keysList: string[], callback: (event: KeyboardEvent) => void, options?: Options): void;
export { useKeys };
//# sourceMappingURL=useKeys.d.ts.map