Sync immediately on app window focus

This commit is contained in:
Adrian Gruntkowski 2025-11-09 12:48:03 +01:00
parent 2e0d7d044b
commit 8d12c66141
2 changed files with 8 additions and 7 deletions

View file

@ -54,7 +54,6 @@
</form>
<div id="notifications-pane" class="hidden">
<!-- Hidden for now, until push notifications are implemented -->
<button id="enable-notifications" class="hidden">
Enable notifications
</button>

View file

@ -54,6 +54,8 @@ const sync = async () => {
Notes.saveStorage();
};
window.addEventListener("focus", sync);
if (isLoggedIn) {
setInterval(sync, 5000);
}
@ -76,7 +78,7 @@ if (!isLoggedIn) {
if (notificationsAvailable()) {
document.querySelector("#notifications-pane").classList.remove("hidden");
const notificationsButton = document.querySelector("#enable-notifications");
const notificationsTestButton = document.querySelector("#test-notifications");
// const notificationsTestButton = document.querySelector("#test-notifications");
if (!notificationsEnabled()) {
notificationsButton.classList.remove("hidden");
@ -85,11 +87,11 @@ if (notificationsAvailable()) {
});
}
notificationsTestButton.addEventListener("click", () => {
setTimeout(() => {
sendNotification("reminder", "This is a test reminder!");
}, 8000);
});
// notificationsTestButton.addEventListener("click", () => {
// setTimeout(() => {
// sendNotification("reminder", "This is a test reminder!");
// }, 8000);
// });
}
// Search