mirror of
https://git.rezel.net/LudoTech/traque.git
synced 2026-04-11 00:30:19 +02:00
Fix background task + socket in services + cleaning
This commit is contained in:
@@ -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 };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user