From f5c6e8b211c7deee5e2830924cc26b8d49a42f74 Mon Sep 17 00:00:00 2001 From: Andrew Blair Date: Mon, 18 Dec 2017 12:02:01 -0800 Subject: [PATCH 1/2] 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](https://github.com/webpack/webpack-dev-server/issues/1090#issuecomment-352537184) --- client/socket.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/socket.js b/client/socket.js index 38e3cd5b38..10e42ba203 100644 --- a/client/socket.js +++ b/client/socket.js @@ -5,7 +5,7 @@ const SockJS = require('sockjs-client/dist/sockjs'); let retries = 0; let sock = null; -function socket(url, handlers) { +const socket = function(url, handlers) { sock = new SockJS(url); sock.onopen = function onopen() { From b53ef9960eb708078e171e92a5852d24825529a7 Mon Sep 17 00:00:00 2001 From: Andrew Blair Date: Mon, 18 Dec 2017 12:40:00 -0800 Subject: [PATCH 2/2] named function to satisfy linter --- client/socket.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/socket.js b/client/socket.js index 10e42ba203..b265222359 100644 --- a/client/socket.js +++ b/client/socket.js @@ -5,7 +5,7 @@ const SockJS = require('sockjs-client/dist/sockjs'); let retries = 0; let sock = null; -const socket = function(url, handlers) { +const socket = function initSocket(url, handlers) { sock = new SockJS(url); sock.onopen = function onopen() { @@ -37,6 +37,6 @@ const socket = function(url, handlers) { const msg = JSON.parse(e.data); if (handlers[msg.type]) { handlers[msg.type](msg.data); } }; -} +}; module.exports = socket;