| 12 | styleUrl: './app.component.css', |
| 13 | }) |
| 14 | export 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…