MCPcopy
hub / github.com/angular/angularfire / constructor

Method constructor

src/compat/functions/functions.ts:31–70  ·  view source on GitHub ↗
(
    @Inject(FIREBASE_OPTIONS) options: FirebaseOptions,
    @Optional() @Inject(FIREBASE_APP_NAME) name: string | null | undefined,
    zone: NgZone,
    schedulers: ɵAngularFireSchedulers,
    @Optional() @Inject(REGION) region: string | null,
    @Optional() @Inject(ORIGIN) origin: string | null,
    @Optional() @Inject(USE_EMULATOR) _useEmulator: any, // can't use the tuple here
    @Optional() _appCheckInstances: AppCheckInstances,
  )

Source from the content-addressed store, hash-verified

29 public readonly httpsCallable: <T = any, R = any>(name: string, options?: HttpsCallableOptions) => (data: T) => Observable<R>;
30
31 constructor(
32 @Inject(FIREBASE_OPTIONS) options: FirebaseOptions,
33 @Optional() @Inject(FIREBASE_APP_NAME) name: string | null | undefined,
34 zone: NgZone,
35 schedulers: ɵAngularFireSchedulers,
36 @Optional() @Inject(REGION) region: string | null,
37 @Optional() @Inject(ORIGIN) origin: string | null,
38 @Optional() @Inject(USE_EMULATOR) _useEmulator: any, // can't use the tuple here
39 @Optional() _appCheckInstances: AppCheckInstances,
40 ) {
41 const useEmulator: UseEmulatorArguments | null = _useEmulator;
42
43 const functions = of(undefined).pipe(
44 observeOn(schedulers.outsideAngular),
45 switchMap(() => import('firebase/compat/functions')),
46 map(() => ɵfirebaseAppFactory(options, zone, name)),
47 map(app => ɵcacheInstance(`${app.name}.functions.${region || origin}`, 'AngularFireFunctions', app.name, () => {
48 let functions: firebase.functions.Functions;
49 if (region && origin) {
50 throw new Error('REGION and ORIGIN can\'t be used at the same time.');
51 }
52 functions = app.functions(region || origin || undefined);
53 if (useEmulator) {
54 functions.useEmulator(...useEmulator);
55 }
56 return functions;
57 }, [region, origin, useEmulator])),
58 shareReplay({ bufferSize: 1, refCount: false })
59 );
60
61 this.httpsCallable = <T = any, R = any>(name: string, options?: HttpsCallableOptions) =>
62 (data: T) => from(functions).pipe(
63 observeOn(schedulers.insideAngular),
64 switchMap(functions => functions.httpsCallable(name, options)(data)),
65 map(r => r.data as R)
66 );
67
68 return ɵlazySDKProxy(this, functions, zone);
69
70 }
71
72}
73

Callers

nothing calls this directly

Calls 3

ɵfirebaseAppFactoryFunction · 0.90
ɵcacheInstanceFunction · 0.90
ɵlazySDKProxyFunction · 0.90

Tested by

no test coverage detected