shortcutter
Version:
Tiny, dependency-free library to manage keyboard shortcuts in your application.
26 lines (25 loc) • 1.42 kB
TypeScript
export declare function useContexts(): {
readonly add: (name: string) => {
add: (shortcut: string[], callback: (event: Event, phase: import("./types").PHASES) => void, phases?: import("./types").PHASES) => void;
get(shortcut: string[], phase: import("./types").PHASES): ((event: Event, phase: import("./types").PHASES) => void) | undefined;
has(shortcut: string[], phase: import("./types").PHASES): boolean;
remove(shortcut: string[], phases?: import("./types").PHASES): void;
getAll(): string[];
clear(): void;
};
readonly clear: () => void;
readonly getActive: () => string[];
readonly get: (name: string) => {
add: (shortcut: string[], callback: (event: Event, phase: import("./types").PHASES) => void, phases?: import("./types").PHASES) => void;
get(shortcut: string[], phase: import("./types").PHASES): ((event: Event, phase: import("./types").PHASES) => void) | undefined;
has(shortcut: string[], phase: import("./types").PHASES): boolean;
remove(shortcut: string[], phases?: import("./types").PHASES): void;
getAll(): string[];
clear(): void;
} | undefined;
readonly getAll: () => string[];
readonly has: (name: string) => boolean;
readonly isActive: (name: string) => boolean;
readonly remove: (name: string) => void;
readonly setActive: (...contexts: string[]) => void;
};