From 8233d030e5f5f40a639e90fafc10da6571273497 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 4 Jan 2023 10:59:09 +0200 Subject: [PATCH] Don't pointlessly assign global.socket = app.socket Note that the code changed is inside an anonymous function that is called with one argument: window, for the function parameter called global. Thus the assignment that this change removes sets window.socket. The window.socket variable is not used by code later, so this change can be this minimal. The window.socket variable has earlier been set to the WebSocket object used to communicate with the COOL server. Let's keep it for that purpose. app.socket is the app.definitions.Socket object. Even though JavaScript is not type-safe, it is very confusing to use the same variable for completely different object types at different stages in the code execution. I am working on some new code that will want to access the WebSocket object also later. Signed-off-by: Tor Lillqvist Change-Id: I6273a6d6acee3fa46ab9fedc5742ae44c8bfa567 --- browser/src/main.js | 1 - 1 file changed, 1 deletion(-) diff --git a/browser/src/main.js b/browser/src/main.js index e7f1e09fc..909c211ed 100644 --- a/browser/src/main.js +++ b/browser/src/main.js @@ -70,7 +70,6 @@ L.Map.THIS = map; map.loadDocument(global.socket); -global.socket = app.socket; window.addEventListener('beforeunload', function () { if (map && app.socket) { if (app.socket.setUnloading)