throttle mouse events

This commit is contained in:
Gavin McDonald
2025-07-02 12:07:14 -04:00
parent d531a9bd6a
commit 522fdf106e
2 changed files with 7 additions and 7 deletions

View File

@@ -1,8 +1,5 @@
import { useEffect } from 'react';
import { socket } from '@/socket';
import throttle from '@/tools/throttle';
import { thirtyFPS } from '@/constants/time';
import type { GameUpdate, Tilt } from '@/types';
interface UseSocketProps {
@@ -70,12 +67,12 @@ export default function useSocket({ gameID, setGameData, setNoGame }: UseSocketP
});
};
const emitTilt = throttle((cardIndex: number, tilt: Tilt) => {
const emitTilt = (cardIndex: number, tilt: Tilt) => {
socket.emit('tilt', {
cardIndex,
tilt,
});
}, thirtyFPS);
};
return {
emitFlip,