Avoid restarting the connection when leaving the game
authorRaphaël Jakse <raphael.trivabble@jakse.fr>
Tue, 14 Apr 2020 22:43:41 +0000 (00:43 +0200)
committerRaphaël Jakse <raphael.trivabble@jakse.fr>
Tue, 14 Apr 2020 22:43:41 +0000 (00:43 +0200)
trivabble.js

index caa15626dc78d08dbc83aba910f41d6428aaf650..3a4844110b5e371f528677e1bd35298a9ec0c7d5 100644 (file)
 
     window.addEventListener("DOMContentLoaded", initLang);
 
+    window.addEventListener("beforeunload", stopConnection);
+
     window.addEventListener("offline", function () {
         stopConnection();
         showConnectionLost(_("It seems your browser went offline. Please reconnect to continue playing."));