Better close of websocket handling

merge-requests/237/merge
Tag 2023-02-22 16:51:31 -08:00
rodzic c9f2e60163
commit 26af8c66ac
2 zmienionych plików z 16 dodań i 20 usunięć

Wyświetl plik

@ -2719,6 +2719,7 @@ function onRightClickGridSquare(feature)
new_win.on("loaded", function ()
{
GT.popupWindowHandle.show();
GT.popupWindowHandle.focus();
renderTooltipWindow(feature);
});
new_win.on("close", function ()
@ -7727,9 +7728,9 @@ function resetSearch()
GT.lastSearchSelection = null;
}
function showWorkedByCall(callsign, evt)
function showWorkedByCall(callsign, event)
{
evt.preventDefault();
event.preventDefault();
resetSearch();
GT.searchWB = callsign;
@ -7830,10 +7831,7 @@ function showWorkedBox(sortIndex, nextPage, redraw)
bands[list[key].band] = list[key].band;
modes[list[key].mode] = list[key].mode;
var unconfirmedCallsKey = new UnconfirmedCallsKey(list[key].dxcc, list[key].band);
if (
GT.unconfirmedCalls.has(unconfirmedCallsKey.key) &&
list[key].confirmed
)
if (GT.unconfirmedCalls.has(unconfirmedCallsKey.key) && list[key].confirmed)
{
GT.unconfirmedCalls.set(unconfirmedCallsKey.key, GT.unconfirmedCallsSentinel);
}
@ -8447,6 +8445,7 @@ function showDXCCsBox()
new_win.on("loaded", function ()
{
GT.popupWindowHandle.show();
GT.popupWindowHandle.focus();
renderTooltipWindowLogbook(GT.unconfirmedCalls.get(unconfirmedCallsKey.key));
});
new_win.on("close", function ()

Wyświetl plik

@ -120,11 +120,14 @@ function gtConnectChat()
GT.gtChatSocket.onerror = function ()
{
this.close();
GT.gtChatSocket = null;
GT.gtState = ChatState.error;
};
GT.gtChatSocket.onclose = function ()
{
GT.gtChatSocket = null;
GT.gtState = ChatState.closed;
};
}
@ -151,20 +154,20 @@ function closeGtSocket()
{
gtChatSendClose();
if (GT.gtChatSocket.readyState != WebSocket.CLOSED) GT.gtChatSocket.close();
if (GT.gtChatSocket.readyState === WebSocket.CLOSED)
{
GT.gtChatSocket = null;
GT.gtState = ChatState.none;
}
GT.gtChatSocket.close();
GT.gtChatSocket = null;
GT.gtState = ChatState.none;
}
else GT.gtState = ChatState.none;
}
function gtClosedSocket()
{
GT.gtChatSocket = null;
if (GT.gtChatSocket != null)
{
GT.gtChatSocket.close();
GT.gtChatSocket = null;
}
GT.gtState = ChatState.none;
}
@ -320,12 +323,6 @@ function gtChatRemoveCall(jsmesg)
{
delete GT.gtFlagPins[cid].ids[id];
}
else
{
console.log("drop: No such id in GT.gtFlagPins.ids:");
console.log(jsmesg);
console.log(GT.gtFlagPins[cid].ids);
}
if (Object.keys(GT.gtFlagPins[cid].ids).length == 0)
{