Defined in: controllers/held-keys.ts:26
A Lit ReactiveController that tracks all currently held keyboard keys.
Subscribes to the global KeyStateTracker and triggers host updates whenever keys are pressed or released.
class KeyDisplay extends LitElement {
private heldKeys = new HeldKeysController(this)
render() {
return html`
<div>
Currently pressed: ${this.heldKeys.value.join(' + ') || 'None'}
</div>
`
}
}class KeyDisplay extends LitElement {
private heldKeys = new HeldKeysController(this)
render() {
return html`
<div>
Currently pressed: ${this.heldKeys.value.join(' + ') || 'None'}
</div>
`
}
}new HeldKeysController(_host): HeldKeysController;new HeldKeysController(_host): HeldKeysController;Defined in: controllers/held-keys.ts:40
ReactiveControllerHost
The Lit component that owns this controller.
HeldKeysController
get value(): string[];get value(): string[];Defined in: controllers/held-keys.ts:33
Array of currently held key names.
string[]
hostConnected(): void;hostConnected(): void;Defined in: controllers/held-keys.ts:45
Subscribes to the tracker store and updates the internal state when changes occur.
void
ReactiveController.hostConnectedReactiveController.hostConnectedhostDisconnected(): void;hostDisconnected(): void;Defined in: controllers/held-keys.ts:59
Unsubscribes from the tracker store and stops tracking the held keys.
void
ReactiveController.hostDisconnectedReactiveController.hostDisconnected