| 23 | export type KeybindingFilter = (event: KeyboardEvent) => boolean |
| 24 | |
| 25 | export interface KeybindingHandlerOptions { |
| 26 | /** |
| 27 | * Keybinding sequences will wait this long between key presses before |
| 28 | * cancelling (default: 1000). |
| 29 | * |
| 30 | * **Note:** Setting this value too low (i.e. `300`) will be too fast for many |
| 31 | * of your users. |
| 32 | */ |
| 33 | timeout?: number |
| 34 | |
| 35 | /** |
| 36 | * Customize the behavior of which keyboard events will be ignored/skipped. |
| 37 | * |
| 38 | * By default this uses the behavior of {@link defaultKeybindingsHandlerIgnore}. |
| 39 | * |
| 40 | * @example Allow all events |
| 41 | * ```tsx |
| 42 | * tinykeys(window, {...}, { |
| 43 | * ignore: () => false |
| 44 | * }) |
| 45 | * ``` |
| 46 | * |
| 47 | * @example Extend the default ignore |
| 48 | * ```tsx |
| 49 | * tinykeys(window, {...}, { |
| 50 | * ignore: event => { |
| 51 | * return ( |
| 52 | * // Also ignore events inside a dialog |
| 53 | * event.target.closest("dialog") != null && |
| 54 | * defaultKeybindingsHandlerIgnore(event) |
| 55 | * ); |
| 56 | * } |
| 57 | * }) |
| 58 | * ``` |
| 59 | */ |
| 60 | ignore?: KeybindingFilter |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Options to configure the behavior of keybindings. |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…