quit game and clear interval
This commit is contained in:
parent
5886f9413b
commit
8be14ac546
@ -19,9 +19,10 @@
|
||||
"key": "^0.1.11",
|
||||
"keymaster": "^1.6.2",
|
||||
"lodash": "^4.17.11",
|
||||
"parcel": "^1.9.7",
|
||||
"phaser": "^3.15.1",
|
||||
"preact": "^8.3.1",
|
||||
"preact-redux": "^2.0.3",
|
||||
"parcel": "^1.9.7",
|
||||
"redux": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@ -11,7 +11,13 @@ const GameContainer = require('./game.container');
|
||||
|
||||
const addState = connect(
|
||||
function receiveState(state) {
|
||||
const {game} = state;
|
||||
const { game, ws } = state;
|
||||
|
||||
if (!game) {
|
||||
console.log('out of game');
|
||||
ws.clearGameStateInterval();
|
||||
}
|
||||
|
||||
return { game };
|
||||
},
|
||||
function receiveDispatch(dispatch) {
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user