UNPKG

@brr-dev/hotkey

Version:

A simple, lightweight library for binding hotkeys using Vanilla JS, with no external dependencies.

28 lines (25 loc) 648 B
type HotKeyCallback = (event: KeyboardEvent) => false | void; type HotKeyOptions = { key: string; callback: HotKeyCallback; target?: HTMLElement; ctrl?: boolean; alt?: boolean; shift?: boolean; }; declare class HotKey { key: string; alt: boolean; ctrl: boolean; shift: boolean; target: HTMLElement; callback: HotKeyCallback; /** * Create a new HotKey binding with the given options. */ constructor(options: HotKeyOptions); unbind(): void; satisfiesEvent(event: KeyboardEvent): boolean; toString(): string; } export { HotKey, type HotKeyCallback, type HotKeyOptions };