Skip to content

Commit

Permalink
Fix beforeunload on iphone
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinLinus committed Sep 21, 2018
1 parent 728aabd commit 4cf2bed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client/scripts/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ class ServerConnection {
constructor() {
this._connect();
Events.on('beforeunload', e => this._disconnect(), false);
Events.on('pageshow', e => this._connect(), false);
Events.on('pagehide', e => this._disconnect(), false);
}

_connect() {
if (this._isConnected()) return
if (this._isConnected()) return;
const ws = new WebSocket(this._endpoint());
ws.binaryType = 'arraybuffer';
ws.onopen = e => console.log('WS: server connected');
Expand Down

0 comments on commit 4cf2bed

Please sign in to comment.