quit game and clear interval
This commit is contained in:
@@ -11,8 +11,14 @@ const GameContainer = require('./game.container');
|
||||
|
||||
const addState = connect(
|
||||
function receiveState(state) {
|
||||
const {game} = state;
|
||||
return {game};
|
||||
const { game, ws } = state;
|
||||
|
||||
if (!game) {
|
||||
console.log('out of game');
|
||||
ws.clearGameStateInterval();
|
||||
}
|
||||
|
||||
return { game };
|
||||
},
|
||||
function receiveDispatch(dispatch) {
|
||||
function setGame(game) {
|
||||
|
||||
@@ -151,6 +151,14 @@ function createSocket(store) {
|
||||
}
|
||||
|
||||
|
||||
// -------------
|
||||
// Events
|
||||
// -------------
|
||||
|
||||
function clearGameStateInterval() {
|
||||
clearInterval(gameStateTimeout);
|
||||
}
|
||||
|
||||
// -------------
|
||||
// Handling
|
||||
// -------------
|
||||
@@ -182,6 +190,7 @@ function createSocket(store) {
|
||||
}
|
||||
|
||||
return {
|
||||
clearGameStateInterval,
|
||||
sendAccountLogin,
|
||||
sendAccountRegister,
|
||||
sendGameState,
|
||||
|
||||
Reference in New Issue
Block a user