MCPcopy Create free account
hub / github.com/TanStack/hotkeys / AppComponent

Class AppComponent

examples/angular/injectHeldKeys/src/app/app.component.ts:14–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12 styleUrl: './app.component.css',
13})
14export class AppComponent {
15 heldKeys = injectHeldKeys()
16 heldCodes = injectHeldKeyCodes()
17 history = signal<string[]>([])
18 readonly formatForDisplay = formatForDisplay
19
20 constructor() {
21 effect(() => {
22 const keys = this.heldKeys()
23 if (keys.length > 0) {
24 const combo = keys
25 .map((k) => formatForDisplay(k, { useSymbols: true }))
26 .join(' + ')
27 this.history.update((h) => {
28 if (h[h.length - 1] !== combo) {
29 return [...h.slice(-9), combo]
30 }
31 return h
32 })
33 }
34 })
35 }
36
37 clearHistory(): void {
38 this.history.set([])
39 }
40}

Callers

nothing calls this directly

Calls 2

injectHeldKeysFunction · 0.90
injectHeldKeyCodesFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…