Home > @firebase/firestore > / > onSnapshotsInSync
onSnapshotsInSync() function
Attaches a listener for a snapshots-in-sync event. The snapshots-in-sync event indicates that all listeners affected by a given change have fired, even if a single server-generated change affects multiple listeners.
NOTE: The snapshots-in-sync event only indicates that listeners are in sync with each other, but does not relate to whether those snapshots are in sync with the server. Use SnapshotMetadata in the individual listeners to determine if a snapshot is from the cache or the server.
Signature:
export declare function onSnapshotsInSync(firestore: FirebaseFirestore, observer: {
next?: (value: void) => void;
error?: (error: FirestoreError) => void;
complete?: () => void;
}): Unsubscribe;
Parameters
Parameter | Type | Description |
---|---|---|
firestore | FirebaseFirestore | The instance of Firestore for synchronizing snapshots. |
observer | { next?: (value: void) => void; error?: (error: FirestoreError) => void; complete?: () => void; } | A single object containing next and error callbacks. |
Returns:
An unsubscribe function that can be called to cancel the snapshot listener.