Defined in: controllers/hotkey.ts:34
A Lit ReactiveController that registers a keyboard hotkey when the host element is connected and unregisters it when the host is disconnected.
class MyElement extends LitElement {
private hotkey = new HotkeyController(this, 'Mod+S', () => this.save())
constructor() {
super()
this.addController(this.hotkey)
}
}class MyElement extends LitElement {
private hotkey = new HotkeyController(this, 'Mod+S', () => this.save())
constructor() {
super()
this.addController(this.hotkey)
}
}new HotkeyController(
_host,
_hotkey,
_callback,
_options): HotkeyController;new HotkeyController(
_host,
_hotkey,
_callback,
_options): HotkeyController;Defined in: controllers/hotkey.ts:44
ReactiveControllerHost
The Lit component that owns this controller (use this and pass it to addController()).
RegisterableHotkey
The key or key combo to listen for (e.g. 'Mod+S' or a raw hotkey object).
HotkeyCallback
Function to run when the hotkey is pressed; called with the host as this.
HotkeyOptions = HOTKEY_DEFAULT_OPTIONS
Optional registration options (target, platform, enabled, etc.).
HotkeyController
hostConnected(): void;hostConnected(): void;Defined in: controllers/hotkey.ts:55
Registers the hotkey with the global manager when the host is connected to the DOM. Skips registration if no target is available (e.g. no document or options.target is null).
void
ReactiveController.hostConnectedReactiveController.hostConnectedhostDisconnected(): void;hostDisconnected(): void;Defined in: controllers/hotkey.ts:90
Unregisters the hotkey when the host is disconnected from the DOM.
void
ReactiveController.hostDisconnectedReactiveController.hostDisconnected