Chrome APIsintermediate
Background Sync for offline-friendly actions
type SyncRegistration = ServiceWorkerRegistration & { sync: { register: (tag: string) => Promise<void> } };
export const scheduleOfflineAction = async (tag: string, replayNow: () => Promise<void>): Promise<void> => {
const registration = await navigator.serviceWorker.ready;
const canBackgroundSync = "sync" in registration;Replay user actions later when connectivity returns with Background Sync.