fix: Add Background Sync API type declarations
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
9c618cffb7
commit
aa501b1778
|
|
@ -2,6 +2,15 @@
|
|||
|
||||
import { useEffect, useCallback, useRef } from 'react';
|
||||
|
||||
// Background Sync API types (not in default TypeScript libs)
|
||||
interface SyncManager {
|
||||
register(tag: string): Promise<void>;
|
||||
}
|
||||
|
||||
interface ServiceWorkerRegistrationWithSync extends ServiceWorkerRegistration {
|
||||
sync: SyncManager;
|
||||
}
|
||||
|
||||
interface UseServiceWorkerMessagesOptions {
|
||||
onLocationRequest?: () => void;
|
||||
onLocationSync?: () => void;
|
||||
|
|
@ -51,7 +60,7 @@ export function useServiceWorkerMessages(options: UseServiceWorkerMessagesOption
|
|||
}
|
||||
|
||||
try {
|
||||
const registration = await navigator.serviceWorker.ready;
|
||||
const registration = await navigator.serviceWorker.ready as ServiceWorkerRegistrationWithSync;
|
||||
await registration.sync.register('rmaps-location-sync');
|
||||
console.log('[App] Background sync registered');
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue