Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

onSnapshot

Attaches a listener for DocumentSnapshot events. You may either pass individual onNext and onError callbacks or pass a single observer object with next and error callbacks.

NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending.

function onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, observer: {
next?: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
error?: (error: FirestoreError) => void;
complete?: () => void;
}
): Unsubscribe;
function onSnapshot<AppModelType, DbModelType extends DocumentData>(
reference: DocumentReference<AppModelType, DbModelType>,
observer: {
next?: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
error?: (error: FirestoreError) => void;
complete?: () => void;
}
,
): Unsubscribe;
function onSnapshot<AppModelType, DbModelType extends DocumentData>(
reference: DocumentReference<AppModelType, DbModelType>,
onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void,
onError?: (error: FirestoreError) => void,
onCompletion?: () => void,
): Unsubscribe;
function onSnapshot<AppModelType, DbModelType extends DocumentData>(
reference: DocumentReference<AppModelType, DbModelType>,
onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void,
onError?: (error: FirestoreError) => void,
onCompletion?: () => void,
): Unsubscribe;
function onSnapshot<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, observer: {
next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
error?: (error: FirestoreError) => void;
complete?: () => void;
}
): Unsubscribe;
function onSnapshot<AppModelType, DbModelType extends DocumentData>(
query: Query<AppModelType, DbModelType>,
observer: {
next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
error?: (error: FirestoreError) => void;
complete?: () => void;
}
,
): Unsubscribe;
function onSnapshot<AppModelType, DbModelType extends DocumentData>(
query: Query<AppModelType, DbModelType>,
onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void,
onError?: (error: FirestoreError) => void,
onCompletion?: () => void,
): Unsubscribe;
function onSnapshot<AppModelType, DbModelType extends DocumentData>(
query: Query<AppModelType, DbModelType>,
onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void,
onError?: (error: FirestoreError) => void,
onCompletion?: () => void,
): Unsubscribe;
§
onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, observer: {
next?: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
error?: (error: FirestoreError) => void;
complete?: () => void;
}
): Unsubscribe
[src]

Attaches a listener for DocumentSnapshot events. You may either pass individual onNext and onError callbacks or pass a single observer object with next and error callbacks.

NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending.

§Type Parameters

§
AppModelType
[src]
§
DbModelType extends DocumentData
[src]

§Parameters

§
reference: DocumentReference<AppModelType, DbModelType>
[src]
  • A reference to the document to listen to.
§
observer: {
next?: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
error?: (error: FirestoreError) => void;
complete?: () => void;
}
[src]
  • A single object containing next and error callbacks.

§Return Type

§

An unsubscribe function that can be called to cancel the snapshot listener.

§
onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, options: SnapshotListenOptions, observer: {
next?: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
error?: (error: FirestoreError) => void;
complete?: () => void;
}
): Unsubscribe
[src]

Attaches a listener for DocumentSnapshot events. You may either pass individual onNext and onError callbacks or pass a single observer object with next and error callbacks.

NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending.

§Type Parameters

§
AppModelType
[src]
§
DbModelType extends DocumentData
[src]

§Parameters

§
reference: DocumentReference<AppModelType, DbModelType>
[src]
  • A reference to the document to listen to.
§
  • Options controlling the listen behavior.
§
observer: {
next?: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
error?: (error: FirestoreError) => void;
complete?: () => void;
}
[src]
  • A single object containing next and error callbacks.

§Return Type

§

An unsubscribe function that can be called to cancel the snapshot listener.

§
onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe
[src]

Attaches a listener for DocumentSnapshot events. You may either pass individual onNext and onError callbacks or pass a single observer object with next and error callbacks.

NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending.

§Type Parameters

§
AppModelType
[src]
§
DbModelType extends DocumentData
[src]

§Parameters

§
reference: DocumentReference<AppModelType, DbModelType>
[src]
  • A reference to the document to listen to.
§
onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void
[src]
  • A callback to be called every time a new DocumentSnapshot is available.
§
onError?: (error: FirestoreError) => void optional
[src]
  • A callback to be called if the listen fails or is cancelled. No further callbacks will occur.
§
onCompletion?: () => void optional
[src]
  • Can be provided, but will not be called since streams are never ending.

§Return Type

§

An unsubscribe function that can be called to cancel the snapshot listener.

§
onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, options: SnapshotListenOptions, onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe
[src]

Attaches a listener for DocumentSnapshot events. You may either pass individual onNext and onError callbacks or pass a single observer object with next and error callbacks.

NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending.

§Type Parameters

§
AppModelType
[src]
§
DbModelType extends DocumentData
[src]

§Parameters

§
reference: DocumentReference<AppModelType, DbModelType>
[src]
  • A reference to the document to listen to.
§
  • Options controlling the listen behavior.
§
onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void
[src]
  • A callback to be called every time a new DocumentSnapshot is available.
§
onError?: (error: FirestoreError) => void optional
[src]
  • A callback to be called if the listen fails or is cancelled. No further callbacks will occur.
§
onCompletion?: () => void optional
[src]
  • Can be provided, but will not be called since streams are never ending.

§Return Type

§

An unsubscribe function that can be called to cancel the snapshot listener.

§
onSnapshot<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, observer: {
next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
error?: (error: FirestoreError) => void;
complete?: () => void;
}
): Unsubscribe
[src]

Attaches a listener for QuerySnapshot events. You may either pass individual onNext and onError callbacks or pass a single observer object with next and error callbacks. The listener can be cancelled by calling the function that is returned when onSnapshot is called.

NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending.

§Type Parameters

§
AppModelType
[src]
§
DbModelType extends DocumentData
[src]

§Parameters

§
query: Query<AppModelType, DbModelType>
[src]
  • The query to listen to.
§
observer: {
next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
error?: (error: FirestoreError) => void;
complete?: () => void;
}
[src]
  • A single object containing next and error callbacks.

§Return Type

§

An unsubscribe function that can be called to cancel the snapshot listener.

§
onSnapshot<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, options: SnapshotListenOptions, observer: {
next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
error?: (error: FirestoreError) => void;
complete?: () => void;
}
): Unsubscribe
[src]

Attaches a listener for QuerySnapshot events. You may either pass individual onNext and onError callbacks or pass a single observer object with next and error callbacks. The listener can be cancelled by calling the function that is returned when onSnapshot is called.

NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending.

§Type Parameters

§
AppModelType
[src]
§
DbModelType extends DocumentData
[src]

§Parameters

§
query: Query<AppModelType, DbModelType>
[src]
  • The query to listen to.
§
  • Options controlling the listen behavior.
§
observer: {
next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
error?: (error: FirestoreError) => void;
complete?: () => void;
}
[src]
  • A single object containing next and error callbacks.

§Return Type

§

An unsubscribe function that can be called to cancel the snapshot listener.

§
onSnapshot<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe
[src]

Attaches a listener for QuerySnapshot events. You may either pass individual onNext and onError callbacks or pass a single observer object with next and error callbacks. The listener can be cancelled by calling the function that is returned when onSnapshot is called.

NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending.

§Type Parameters

§
AppModelType
[src]
§
DbModelType extends DocumentData
[src]

§Parameters

§
query: Query<AppModelType, DbModelType>
[src]
  • The query to listen to.
§
onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void
[src]
  • A callback to be called every time a new QuerySnapshot is available.
§
onError?: (error: FirestoreError) => void optional
[src]
  • A callback to be called if the listen fails or is cancelled. No further callbacks will occur.
§
onCompletion?: () => void optional
[src]
  • Can be provided, but will not be called since streams are never ending.

§Return Type

§

An unsubscribe function that can be called to cancel the snapshot listener.

§
onSnapshot<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, options: SnapshotListenOptions, onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe
[src]

Attaches a listener for QuerySnapshot events. You may either pass individual onNext and onError callbacks or pass a single observer object with next and error callbacks. The listener can be cancelled by calling the function that is returned when onSnapshot is called.

NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending.

§Type Parameters

§
AppModelType
[src]
§
DbModelType extends DocumentData
[src]

§Parameters

§
query: Query<AppModelType, DbModelType>
[src]
  • The query to listen to.
§
  • Options controlling the listen behavior.
§
onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void
[src]
  • A callback to be called every time a new QuerySnapshot is available.
§
onError?: (error: FirestoreError) => void optional
[src]
  • A callback to be called if the listen fails or is cancelled. No further callbacks will occur.
§
onCompletion?: () => void optional
[src]
  • Can be provided, but will not be called since streams are never ending.

§Return Type

§

An unsubscribe function that can be called to cancel the snapshot listener.