mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
fix focusing
This commit is contained in:
parent
bb1c01635e
commit
519b5b7012
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user