本页还没有译文
本页 43 段还没译成日本語,下面显示的是英文原文。HotkeyController
还没翻译译自英文(tanstack.com)本页 43 段都还没译
Defined in: controllers/hotkey.ts:26
A Lit ReactiveController that registers a keyboard hotkey when the host element is connected and unregisters it when the host is disconnected.
Example
class MyElement extends LitElement {
private hotkey = new HotkeyController(this, 'Mod+S', () => this.save())
constructor() {
super()
this.addController(this.hotkey)
}
}Implements
ReactiveController
Constructors
Constructor
new HotkeyController(
_host,
_hotkey,
callback,
_options?): HotkeyController;Defined in: controllers/hotkey.ts:37
Parameters
_host
ReactiveControllerHost
The Lit component that owns this controller. Add the controller with addController().
_hotkey
RegisterableHotkey
The shortcut to register.
callback
HotkeyCallback
Called with the host as this.
_options?
HotkeyOptions | (() => HotkeyOptions)
Options or a getter. Property getters are read on connection and after host updates.
Returns
HotkeyController
Methods
hostConnected()
hostConnected(): void;Defined in: controllers/hotkey.ts:48
Registers when connected and a target is available.
Returns
void
Implementation of
ReactiveController.hostConnectedhostDisconnected()
hostDisconnected(): void;Defined in: controllers/hotkey.ts:67
Releases registrations when the host disconnects.
Returns
void
Implementation of
ReactiveController.hostDisconnectedhostUpdated()
hostUpdated(): void;Defined in: controllers/hotkey.ts:54
Refreshes options after rendering, when scoped targets are available.
Returns
void
Implementation of
ReactiveController.hostUpdated