Skip to content

Commit

Permalink
iOS Safari 10 bug where SockJS couldn't be found (#1238)
Browse files Browse the repository at this point in the history
* iOS Safari 10 bug where SockJS couldn't be found

Fixes iOS Safari 10 bug. At the root, this works around a bug where Safari's eval's scope was getting confused.  Something to do with [this issue](https://stackoverflow.com/questions/46036960/evaluated-expression-const-variable-scope-in-safari)

[bug reference](#1090 (comment))

* named function to satisfy linter
  • Loading branch information
abcd-ca authored and shellscape committed Dec 22, 2017
1 parent a168b81 commit aab49de
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const SockJS = require('sockjs-client/dist/sockjs');
let retries = 0;
let sock = null;

function socket(url, handlers) {
const socket = function initSocket(url, handlers) {
sock = new SockJS(url);

sock.onopen = function onopen() {
Expand Down Expand Up @@ -37,6 +37,6 @@ function socket(url, handlers) {
const msg = JSON.parse(e.data);
if (handlers[msg.type]) { handlers[msg.type](msg.data); }
};
}
};

module.exports = socket;

0 comments on commit aab49de

Please sign in to comment.