mirror of
https://github.com/AudebertAdrien/ft_transcendence.git
synced 2026-11-09 18:17:07 +01:00
It worked git add .git add .!
This commit is contained in:
@@ -205,14 +205,15 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
|
||||
function handleKeyDown(event) {
|
||||
console.log('Key press: ', event.key);
|
||||
if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
|
||||
console.log('Key press: ', event.key);
|
||||
sendKeyPress(event.key.toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
function sendKeyPress(key) {
|
||||
if (socket.readyState === WebSocket.OPEN) {
|
||||
console.log('Key sent: ', key);
|
||||
socket.send(JSON.stringify({ type: 'key_press', key }));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user