feat(js): m10 extensions (pause, restart, speed-up via Frame) with tests
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
25141ce86d
commit
fd7c5f2acf
@@ -8,5 +8,11 @@ const directions = {
|
||||
ArrowRight: 'Right', d: 'Right', D: 'Right',
|
||||
}
|
||||
|
||||
// Keys that are not steering (m10).
|
||||
const commands = { ' ': Action.TogglePause, r: Action.Restart, R: Action.Restart }
|
||||
|
||||
// hasOwn, not `key in table`: "constructor" and "toString" are inherited properties, not keys we mapped.
|
||||
export const keyToAction = (key) =>
|
||||
Object.hasOwn(directions, key) ? Action.Turn(directions[key]) : null
|
||||
Object.hasOwn(directions, key) ? Action.Turn(directions[key])
|
||||
: Object.hasOwn(commands, key) ? commands[key]
|
||||
: null
|
||||
|
||||
Reference in New Issue
Block a user