shortcutter
Version:
Tiny, dependency-free library to manage keyboard shortcuts in your application.
15 lines (14 loc) • 639 B
TypeScript
import { PHASES } from '.';
declare type Config = {
eventTarget: EventTarget;
defaultContext: string;
};
declare const DEFAULT_CONFIG: Config;
export declare function useShortcutter(customConfig?: Partial<typeof DEFAULT_CONFIG>): {
readonly listen: (context: string, keys: string[], callback: (event: Event, phase: PHASES) => void, phases?: PHASES) => () => void | undefined;
readonly unlisten: (context: string, keys: string[], phases?: PHASES) => void;
readonly hasContext: (name: string) => boolean;
readonly getActiveContext: () => string[];
readonly setActiveContext: (name: string) => void;
};
export {};