UNPKG

@hypothesis/frontend-shared

Version:

Shared components, styles and utilities for Hypothesis projects

13 lines (12 loc) 487 B
type UseKeyPressOptions = { /** Enable listening for key events? Can be set to false to disable */ enabled?: boolean; }; /** * Listen on HTMLElement `target` for key press events for the designated `keys` * and invoke a callback. Do not listen if not `enabled`. * * @param keys - Array of keys (e.g. 'Escape', 'd') to listen for */ export declare function useKeyPress(keys: string[], callback: (e: KeyboardEvent) => void, { enabled }?: UseKeyPressOptions): void; export {};