X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FHall.vue;h=d0cabb46d8099789751b8f323ff4352f12453496;hp=4d830bbfad98373b7bfa734816690508ea9171f0;hb=3f22c2c3939dfd6bd66da26e6d6d9848c6da86d2;hpb=7c8d5dc740c701b2f744fe492753a876270ac689 diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index 4d830bbf..d0cabb46 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -296,8 +296,8 @@ export default { encodeURIComponent(this.$route.path); this.conn = new WebSocket(this.connexionString); this.conn.onopen = connectAndPoll; - this.conn.onmessage = this.socketMessageListener; - this.conn.onclose = this.socketCloseListener; + this.conn.addEventListener("message", this.socketMessageListener); + this.conn.addEventListener("close", this.socketCloseListener); }, mounted: function() { document.addEventListener('visibilitychange', this.visibilityChange); @@ -653,6 +653,8 @@ export default { break; case "killed": // I logged in elsewhere: + this.conn.removeEventListener("message", this.socketMessageListener); + this.conn.removeEventListener("close", this.socketCloseListener); this.conn = null; alert(this.st.tr["New connexion detected: tab now offline"]); break; @@ -1190,7 +1192,6 @@ export default { // Game state (including FEN): will be updated moves: [], clocks: [-1, -1], //-1 = unstarted - initime: [0, 0], //initialized later score: "*" } );