MCPcopy Create free account
hub / github.com/NativeScript/firebase / get

Method get

packages/firebase-firestore/index.android.ts:878–906  ·  view source on GitHub ↗
(options?: GetOptions)

Source from the content-addressed store, hash-verified

876 }
877
878 get(options?: GetOptions): Promise<DocumentSnapshot<T>> {
879 return new Promise((resolve, reject) => {
880 let source: com.google.firebase.firestore.Source;
881 switch (options) {
882 case GetOptions.Cache:
883 source = com.google.firebase.firestore.Source.CACHE;
884 break;
885 case GetOptions.Server:
886 source = com.google.firebase.firestore.Source.SERVER;
887 break;
888 default:
889 source = com.google.firebase.firestore.Source.DEFAULT;
890 break;
891 }
892
893 org.nativescript.firebase.firestore.FirebaseFirestore.DocumentReference.get(
894 this.native,
895 source,
896 new org.nativescript.firebase.firestore.FirebaseFirestore.Callback<com.google.firebase.firestore.DocumentSnapshot>({
897 onSuccess(ss) {
898 resolve(DocumentSnapshot.fromNative(ss));
899 },
900 onError(error) {
901 reject(FirebaseError.fromNative(error));
902 },
903 })
904 );
905 });
906 }
907
908 onSnapshot(observer: { complete?: () => void; error?: (error: Error) => void; next?: (snapshot: DocumentSnapshot<T>) => void }): () => void;
909 onSnapshot(options: SnapshotListenOptions, observer: { complete?: () => void; error?: (error: Error) => void; next?: (snapshot: DocumentSnapshot<T>) => void }): () => void;

Callers

nothing calls this directly

Calls 1

getMethod · 0.65

Tested by

no test coverage detected