1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

improve web socket close

This commit is contained in:
Luke Pulverenti 2013-09-09 14:23:55 -04:00
parent 4056a61775
commit abef9d9254
3 changed files with 23 additions and 18 deletions

View file

@ -1167,6 +1167,14 @@ $(function () {
if (!IsStorageEnabled()) {
alert("This browser does not support local storage or is running in private mode. For a better experience, try a newer browser such as Chrome (android, desktop), Firefox, IE10, Safari (iOS) or Opera.");
}
$(window).on("beforeunload", function () {
// Close the connection gracefully when possible
if (ApiClient.isWebSocketOpen() && !MediaPlayer.isPlaying()) {
ApiClient.closeWebSocket();
}
});
});
Dashboard.jQueryMobileInit();
@ -1208,4 +1216,5 @@ $(document).on('pagebeforeshow', ".page", function () {
Dashboard.refreshSystemInfoFromServer();
}
});
});