Explorar el Código

Minor improvement of websocket handling

Alexey Edelev hace 5 años
padre
commit
9c5168a9ce
Se han modificado 1 ficheros con 5 adiciones y 2 borrados
  1. 5 2
      web/js/index.js

+ 5 - 2
web/js/index.js

@@ -520,9 +520,12 @@ function connectNotifier() {
     }
 }
 
-window.onbeforeunload = function() {
+$(window).on('beforeunload', function(){
     if (notifierSocket != null) {
-        notifierSocket.onclose = function () {}; // disable onclose handler first
         notifierSocket.close();
+        notifierSocket = null
     }
+});
+
+window.onbeforeunload = function() {
 };