fix focusing

This commit is contained in:
Matthias 2021-11-27 23:14:38 +01:00
parent bb1c01635e
commit 519b5b7012
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076

View File

@ -220,6 +220,11 @@ function inventreeDocReady() {
// Start notification background worker to check every 5 seconds if notifications are available
var notificationRunner = setInterval(notificationCheck, 5000);
// also run when the focus returns
$(document).on('focus', function(e){
notificationCheck();
});
}
@ -229,6 +234,8 @@ function inventreeDocReady() {
**/
var current_alert_state = false;
function notificationCheck() {
// only refresh state if in focus
if (document.hasFocus()) {
inventreeGet(
'/api/notifications/',
{
@ -251,6 +258,7 @@ function notificationCheck() {
}
);
}
}
function isFileTransfer(transfer) {
/* Determine if a transfer (e.g. drag-and-drop) is a file transfer