-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathfirestore.ts
More file actions
30 lines (22 loc) · 883 Bytes
/
firestore.ts
File metadata and controls
30 lines (22 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { ɵgetAllInstancesOf } from '@angular/fire';
import { Firestore as FirebaseFirestore } from 'firebase/firestore';
import { from, timer } from 'rxjs';
import { concatMap, distinct } from 'rxjs/operators';
// see notes in core/firebase.app.module.ts for why we're building the class like this
export interface Firestore extends FirebaseFirestore {}
export class Firestore {
constructor(firestore: FirebaseFirestore) {
return firestore;
}
}
export const FIRESTORE_PROVIDER_NAME = 'firestore';
export interface FirestoreInstances extends Array<FirebaseFirestore> {}
export class FirestoreInstances {
constructor() {
return ɵgetAllInstancesOf<FirebaseFirestore>(FIRESTORE_PROVIDER_NAME);
}
}
export const firestoreInstance$ = timer(0, 300).pipe(
concatMap(() => from(ɵgetAllInstancesOf<FirebaseFirestore>(FIRESTORE_PROVIDER_NAME))),
distinct(),
);