Fix background task + socket in services + cleaning

This commit is contained in:
Sebastien Riviere
2026-02-17 23:48:42 +01:00
parent 05a60612c6
commit 2dfddd86e6
25 changed files with 301 additions and 318 deletions

View File

@@ -1,14 +1,13 @@
// React
import { useCallback } from "react";
// Hook
import { useSocketCommands } from "./useSocketCommands";
// Services
import { emitSendPosition, emitCapture } from "../services/socketEmitter";
export const useGame = () => {
const { emitSendPosition, emitCapture } = useSocketCommands();
const sendCurrentPosition = useCallback(() => {
emitSendPosition();
}, [emitSendPosition]);
}, []);
const capture = useCallback((captureCode) => {
return new Promise((resolve, reject) => {
@@ -22,7 +21,7 @@ export const useGame = () => {
resolve(response);
});
});
}, [emitCapture]);
}, []);
return { sendCurrentPosition, capture };
};