Attempt to gracefully disconnect when user refreshes (#31)

Co-authored-by: Matthew McClaskey <matt@kasmweb.com>
This commit is contained in:
Matt McClaskey 2022-06-24 13:07:13 -04:00 committed by GitHub
parent e3991665d6
commit 7e5a302a7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -166,6 +166,12 @@ const UI = {
}
});
window.addEventListener("beforeunload", (e) => {
if (UI.rfb) {
UI.disconnect();
}
});
return Promise.resolve(UI.rfb);
},