From 7e5a302a7a47472a679391ef24b18a78c936a9f6 Mon Sep 17 00:00:00 2001 From: Matt McClaskey Date: Fri, 24 Jun 2022 13:07:13 -0400 Subject: [PATCH] Attempt to gracefully disconnect when user refreshes (#31) Co-authored-by: Matthew McClaskey --- app/ui.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/ui.js b/app/ui.js index 84e1585a..e5f18d20 100644 --- a/app/ui.js +++ b/app/ui.js @@ -166,6 +166,12 @@ const UI = { } }); + window.addEventListener("beforeunload", (e) => { + if (UI.rfb) { + UI.disconnect(); + } + }); + return Promise.resolve(UI.rfb); },