projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Attempt to get rid of the weird trans-pages errors (especially in Game)
[vchess.git]
/
client
/
src
/
views
/
MyGames.vue
diff --git
a/client/src/views/MyGames.vue
b/client/src/views/MyGames.vue
index
6078394
..
3c2f460
100644
(file)
--- a/
client/src/views/MyGames.vue
+++ b/
client/src/views/MyGames.vue
@@
-58,7
+58,13
@@
export default {
connexionString: ""
};
},
connexionString: ""
};
},
+ watch: {
+ $route: function(to, from) {
+ if (to.path != "/mygames") this.cleanBeforeDestroy();
+ }
+ },
created: function() {
created: function() {
+ window.addEventListener("beforeunload", this.cleanBeforeDestroy);
// Initialize connection
this.connexionString =
params.socketUrl +
// Initialize connection
this.connexionString =
params.socketUrl +
@@
-132,9
+138,13
@@
export default {
});
},
beforeDestroy: function() {
});
},
beforeDestroy: function() {
- this.c
onn.send(JSON.stringify({code: "disconnect"})
);
+ this.c
leanBeforeDestroy(
);
},
methods: {
},
methods: {
+ cleanBeforeDestroy: function() {
+ window.removeEventListener("beforeunload", this.cleanBeforeDestroy);
+ this.conn.send(JSON.stringify({code: "disconnect"}));
+ },
setDisplay: function(type, e) {
this.display = type;
localStorage.setItem("type-myGames", type);
setDisplay: function(type, e) {
this.display = type;
localStorage.setItem("type-myGames", type);