throttle 'tilts' from the server
This commit is contained in:
@@ -25,10 +25,10 @@ export interface AppContext {
|
||||
noGame: boolean;
|
||||
tilt: Tilt[];
|
||||
selectCardIndex: number;
|
||||
flipCard: (cardIndex: number) => void;
|
||||
handleSettings: (gameData: GameUpdate) => void;
|
||||
redraw: (cardIndex: number) => void;
|
||||
select: (cardID: string) => void;
|
||||
emitFlip: (cardIndex: number) => void;
|
||||
emitSettings: (gameData: GameUpdate) => void;
|
||||
emitRedraw: (cardIndex: number) => void;
|
||||
emitSelect: (cardID: string) => void;
|
||||
setGameID: (gameID: string) => void;
|
||||
setSelectCardIndex: (cardIndex: number) => void;
|
||||
setTilt: (tilt: Tilt[]) => void;
|
||||
@@ -41,7 +41,7 @@ export function AppProvider({ children }: { children: ReactNode }) {
|
||||
const [selectCardIndex, setSelectCardIndex] = useState(-1);
|
||||
const [tilt, setTilt] = useState<Tilt[]>([]);
|
||||
|
||||
const { flipCard, redraw, select, handleSettings, emitTilt } = useSocket({
|
||||
const { emitFlip, emitRedraw, emitSelect, emitSettings, emitTilt } = useSocket({
|
||||
gameID,
|
||||
setGameData,
|
||||
setNoGame,
|
||||
@@ -58,7 +58,7 @@ export function AppProvider({ children }: { children: ReactNode }) {
|
||||
const handleSelect = (cardID: string) => {
|
||||
setSelectCardIndex(-1);
|
||||
|
||||
select(selectCardIndex, cardID);
|
||||
emitSelect(selectCardIndex, cardID);
|
||||
};
|
||||
|
||||
const appInterface = {
|
||||
@@ -66,10 +66,10 @@ export function AppProvider({ children }: { children: ReactNode }) {
|
||||
noGame,
|
||||
tilt,
|
||||
selectCardIndex,
|
||||
flipCard,
|
||||
handleSettings,
|
||||
redraw,
|
||||
select: handleSelect,
|
||||
emitFlip,
|
||||
emitSettings,
|
||||
emitRedraw,
|
||||
emitSelect: handleSelect,
|
||||
setGameID,
|
||||
setSelectCardIndex,
|
||||
setTilt,
|
||||
|
||||
Reference in New Issue
Block a user