Something went wrong. Try again.
a simple but full-featured web player for OpenSubsonic music servers (Navidrome, Gonic, Ampache, etc) devins.page/tinysub
svelte typescript javascript subsonic gonic navidrome
Something went wrong. Try again.
TypeScript
123456789101112131415161718192021export type AutoSyncMode = "none" | "scrobbles" | "all";
export const backgroundSyncTag = "tinysub-auto-sync";export const backgroundSyncRequestMessage = "TINYSUB_BACKGROUND_SYNC";export const backgroundSyncConfigMessage = "TINYSUB_BACKGROUND_SYNC_CONFIG";
export const isAutoSyncEligible = (method: string, mode: AutoSyncMode) => mode === "all" || (mode === "scrobbles" && method === "scrobble");
export const updateAppBadge = async (count: number) => { if (typeof globalThis.navigator === "undefined") return; const nav = globalThis.navigator as { setAppBadge?: (contents?: number) => Promise<void>; clearAppBadge?: () => Promise<void>; }; try { if (count > 0) await nav.setAppBadge?.(count); else await nav.clearAppBadge?.(); } catch {}};