projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add a few TODOs to handle invisible disconnections
[vchess.git]
/
public
/
javascripts
/
components
/
game.js
diff --git
a/public/javascripts/components/game.js
b/public/javascripts/components/game.js
index
1338132
..
20d0f47
100644
(file)
--- a/
public/javascripts/components/game.js
+++ b/
public/javascripts/components/game.js
@@
-526,7
+526,11
@@
Vue.component('my-game', {
{
if (!this.oppConnected)
return; //abort move if opponent is gone
{
if (!this.oppConnected)
return; //abort move if opponent is gone
- this.conn.send(JSON.stringify({code:"newmove", move:move, oppid:this.oppid}));
+ try {
+ this.conn.send(JSON.stringify({code:"newmove", move:move, oppid:this.oppid}));
+ } catch(INVALID_STATE_ERR) {
+ return; //abort also if we lost connection
+ }
}
new Audio("/sounds/chessmove1.mp3").play();
this.vr.play(move, "ingame");
}
new Audio("/sounds/chessmove1.mp3").play();
this.vr.play(move, "ingame");