The 30 minutes is in this function by the way.
chrome.windows.getAll({populate: true}, windows => {
if (windowId === chrome.windows.WINDOW_ID_NONE) {
chrome.tabs.query({active: true, currentWindow: true}, tabs => {
if (tabs.length === 0) {
console.log('Storing timeout in backgroundSyncTimeout variable');
ServiceWorkerGlobals.backgroundSyncTimeout = setTimeout(() => {
console.log('All tabs are inactive or minimized');
backgroundInitiation();
}, // 30 minutes);
}
});
} else {
chrome.tabs.query({}, tabs => {
const anyActive = tabs.some(tab => tab.active);
if (anyActive) {
console.log('All tabs are back in focus');
}
});
}
});
});