UNPKG

2 kBTypeScriptView Raw
1import { ReactFireOptions } from './';
2import { ObservableStatus } from './useObservable';
3import { Query as FirestoreQuery, QuerySnapshot, DocumentReference, DocumentData, DocumentSnapshot } from 'firebase/firestore';
4/**
5 * Preload a subscription to a Firestore document reference.
6 *
7 * Use this to warm up `useFirestoreDoc` for a specific document
8 */
9export declare function preloadFirestoreDoc(refProvider: () => Promise<DocumentReference>): Promise<import("./SuspenseSubject").SuspenseSubject<DocumentSnapshot<DocumentData>>>;
10/**
11 * Suscribe to Firestore Document changes
12 *
13 * You can preload data for this hook by calling `preloadFirestoreDoc`
14 */
15export declare function useFirestoreDoc<T = DocumentData>(ref: DocumentReference<T>, options?: ReactFireOptions<T>): ObservableStatus<DocumentSnapshot<T>>;
16/**
17 * Get a firestore document and don't subscribe to changes
18 */
19export declare function useFirestoreDocOnce<T = DocumentData>(ref: DocumentReference<T>, options?: ReactFireOptions<T>): ObservableStatus<DocumentSnapshot<T>>;
20/**
21 * Suscribe to Firestore Document changes and unwrap the document into a plain object
22 */
23export declare function useFirestoreDocData<T = unknown>(ref: DocumentReference<T>, options?: ReactFireOptions<T>): ObservableStatus<T>;
24/**
25 * Get a Firestore document, unwrap the document into a plain object, and don't subscribe to changes
26 */
27export declare function useFirestoreDocDataOnce<T = unknown>(ref: DocumentReference<T>, options?: ReactFireOptions<T>): ObservableStatus<T>;
28/**
29 * Subscribe to a Firestore collection
30 */
31export declare function useFirestoreCollection<T = DocumentData>(query: FirestoreQuery<T>, options?: ReactFireOptions<T[]>): ObservableStatus<QuerySnapshot<T>>;
32/**
33 * Subscribe to a Firestore collection and unwrap the snapshot into an array.
34 */
35export declare function useFirestoreCollectionData<T = DocumentData>(query: FirestoreQuery<T>, options?: ReactFireOptions<T[]>): ObservableStatus<T[]>;