summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2015-01-21 11:09:56 +0200
committerAlon Levy <alon@pobox.com>2015-01-21 11:09:56 +0200
commit3ffa927e40e0dfc1744f049b44e7acdc6ceea2f8 (patch)
tree65b345e388173190bbee96868b1469e7bec15e5a /src/client
parentc55b48924b50f49dd9be2ec16f8cd577a10d8e60 (diff)
client/rz_mesh: there is no socket.close on chrome, avoid calling it for now (need proper replacement?)
Diffstat (limited to 'src/client')
-rw-r--r--src/client/rz_mesh.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/client/rz_mesh.js b/src/client/rz_mesh.js
index 30318cf0..2698b3d9 100644
--- a/src/client/rz_mesh.js
+++ b/src/client/rz_mesh.js
@@ -34,8 +34,12 @@ define([ 'rz_config', 'util', 'model/diff', 'model/util', 'socketio'], function(
// attempt to actively disconnect on tab/window close
// ref: https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers.onbeforeunload
window.addEventListener("beforeunload", function(e){
- socket.close();
- console.log('ws: connection closed on \'beforeunload\' event'); // no one will ever see this but still
+ if (socket.close) {
+ socket.close();
+ console.log('ws: connection closed on \'beforeunload\' event'); // no one will ever see this but still
+ } else {
+ console.log('ws: wanted to close on \'beforeunload\' event but no close function');
+ }
});
}