Replace Array.from() with spread operator

This commit is contained in:
max-lovell 2024-08-05 12:10:25 +01:00
parent 2b1f93d232
commit 3906daad54

View File

@ -48,7 +48,7 @@ export class KeyboardListenerAPI {
private rootKeydownListener(e: KeyboardEvent) { private rootKeydownListener(e: KeyboardEvent) {
// Iterate over a static copy of the listeners set because listeners might add other listeners // Iterate over a static copy of the listeners set because listeners might add other listeners
// that we do not want to be included in the loop // that we do not want to be included in the loop
for (const listener of Array.from(this.listeners)) { for (const listener of [...this.listeners]) {
listener(e); listener(e);
} }
this.heldKeys.add(this.toLowerCaseIfInsensitive(e.key)); this.heldKeys.add(this.toLowerCaseIfInsensitive(e.key));