Maintenance: mail libraries to latest patch versions, badge polling only while the app is visible
build-container / build (push) Successful in 21m26s
build-container / build (push) Successful in 21m26s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
06300578be
commit
bf22aba9dd
2 files changed
+30
-61
No files matched your search
+5
-2
@@ -23,8 +23,11 @@
|
||||
restorePlayer();
|
||||
route();
|
||||
shareCheck();
|
||||
mailPoll(); setInterval(mailPoll, 2 * 60e3);
|
||||
taskPoll(); setInterval(taskPoll, 10 * 60e3);
|
||||
// Unread mail and tasks due (the badge): checked on a timer only while the app is on screen, and again the moment you come back to it.
|
||||
const badgePoll = () => { mailPoll(); taskPoll(); };
|
||||
let lastBadge = Date.now(); badgePoll();
|
||||
setInterval(() => { if (document.visibilityState === 'visible') { lastBadge = Date.now(); badgePoll(); } }, 2 * 60e3);
|
||||
document.addEventListener('visibilitychange', () => { if (document.visibilityState === 'visible' && Date.now() - lastBadge > 30e3) { lastBadge = Date.now(); badgePoll(); } });
|
||||
if ('serviceWorker' in navigator) navigator.serviceWorker.register('/sw.js').catch(() => {});
|
||||
})();
|
||||
|
||||
|
||||
Reference in new issue
Block a user