chore(js): polish pong keys, held mapping and m09 main test

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas WintherandClaude Sonnet 5.5 committed 2026-10-29 00:02:23 +01:00
1 parent 3146bb630a
commit 59bece5443
10 files changed
+209 -16

No files matched your search

+3 -3
View File
@@ -8,14 +8,14 @@ import { keyDowns, keyUps, interval, map, filterMap, merge, scan, startWith } fr
export const FRAME_MS_PONG = 30
const keys = {
ArrowUp: 'Up', w: 'Up',
ArrowDown: 'Down', s: 'Down',
ArrowUp: 'Up', w: 'Up', W: 'Up',
ArrowDown: 'Down', s: 'Down', S: 'Down',
}
// hasOwn, not `key in keys`: "constructor" and "toString" are inherited, not keys we mapped.
export const pongKey = (isDown, key) =>
Object.hasOwn(keys, key) ? (isDown ? PongAction.Press : PongAction.Release)(keys[key])
: key === 'r' && isDown ? PongAction.Restart
: (key === 'r' || key === 'R') && isDown ? PongAction.Restart
: null
export const pongActions = merge(