Now that we can receive game messages from several games at once, make sure the Game module only handles the ones for the current game
This commit is contained in:
parent
81216e3f01
commit
c5e5a7c958
1 changed files with 7 additions and 5 deletions
|
@ -80,11 +80,13 @@ function previously(states) {
|
|||
function initMessageHandlers() {
|
||||
window.addEventListener('focus', catchUp);
|
||||
Messaging.addEventListener(["Game"], function(o) {
|
||||
delay(handleGameMessage(o.state));
|
||||
if(document.hasFocus() && getQueue().length == 1) {
|
||||
catchUp();
|
||||
} else {
|
||||
StatusHandler.set("♪");
|
||||
if(o.state.public.coordinates.gameID == globalState.game.public.coordinates.gameID) {
|
||||
delay(handleGameMessage(o.state));
|
||||
if(document.hasFocus() && getQueue().length == 1) {
|
||||
catchUp();
|
||||
} else {
|
||||
StatusHandler.set("♪");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue