cleanup and refactor

This commit is contained in:
th committed 2026-04-09 19:39:56 +02:00
1 parent 5f9db690a4
commit 73da8fb849
10 files changed
+91 -97

No files matched your search

+4 -4
View File
@@ -1,6 +1,7 @@
// ── CalDAV Sync ──
import { $, esc, api, getCsrf } from './util.js';
import { state } from './state.js';
const CAL_ICONS = [
{ id: 'calendar-dots', label: 'calendar' },
@@ -259,10 +260,9 @@ function showSyncNotification(stats) {
setTimeout(() => { note.style.transition = 'opacity 0.3s'; note.style.opacity = '0'; setTimeout(() => note.remove(), 350); }, 4000);
}
let bgSyncRunning = false;
async function backgroundSync() {
if (bgSyncRunning) return;
bgSyncRunning = true;
if (state.bgSyncRunning) return;
state.bgSyncRunning = true;
try {
const headers = { 'X-CSRF-Token': getCsrf() };
const [res, relayRes] = await Promise.all([
@@ -277,7 +277,7 @@ async function backgroundSync() {
showSyncNotification(total);
}
} catch {} finally {
bgSyncRunning = false;
state.bgSyncRunning = false;
}
}