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

Method constructor

src/compat/storage/storage.ts:32–60  ·  view source on GitHub ↗
(
    @Inject(FIREBASE_OPTIONS) options: FirebaseOptions,
    @Optional() @Inject(FIREBASE_APP_NAME) name: string | null | undefined,
    @Optional() @Inject(BUCKET) storageBucket: string | null,
    // eslint-disable-next-line @typescript-eslint/ban-types
    @Inject(PLATFORM_ID) platformId: Object,
    zone: NgZone,
    schedulers: ɵAngularFireSchedulers,
    @Optional() @Inject(MAX_UPLOAD_RETRY_TIME) maxUploadRetryTime: any,
    @Optional() @Inject(MAX_OPERATION_RETRY_TIME) maxOperationRetryTime: any,
    @Optional() @Inject(USE_EMULATOR) _useEmulator: any,
    @Optional() _appCheckInstances: AppCheckInstances,
  )

Source from the content-addressed store, hash-verified

30 private readonly injector = inject(EnvironmentInjector);
31
32 constructor(
33 @Inject(FIREBASE_OPTIONS) options: FirebaseOptions,
34 @Optional() @Inject(FIREBASE_APP_NAME) name: string | null | undefined,
35 @Optional() @Inject(BUCKET) storageBucket: string | null,
36 // eslint-disable-next-line @typescript-eslint/ban-types
37 @Inject(PLATFORM_ID) platformId: Object,
38 zone: NgZone,
39 schedulers: ɵAngularFireSchedulers,
40 @Optional() @Inject(MAX_UPLOAD_RETRY_TIME) maxUploadRetryTime: any,
41 @Optional() @Inject(MAX_OPERATION_RETRY_TIME) maxOperationRetryTime: any,
42 @Optional() @Inject(USE_EMULATOR) _useEmulator: any,
43 @Optional() _appCheckInstances: AppCheckInstances,
44 ) {
45 const app = ɵfirebaseAppFactory(options, zone, name);
46 this.storage = ɵcacheInstance(`${app.name}.storage.${storageBucket}`, 'AngularFireStorage', app.name, () => {
47 const storage = zone.runOutsideAngular(() => app.storage(storageBucket || undefined));
48 const useEmulator = _useEmulator as UseEmulatorArguments|null;
49 if (useEmulator) {
50 storage.useEmulator(...useEmulator);
51 }
52 if (maxUploadRetryTime) {
53 storage.setMaxUploadRetryTime(maxUploadRetryTime);
54 }
55 if (maxOperationRetryTime) {
56 storage.setMaxOperationRetryTime(maxOperationRetryTime);
57 }
58 return storage;
59 }, [maxUploadRetryTime, maxOperationRetryTime]);
60 }
61
62 ref(path: string) {
63 return createStorageRef(this.storage.ref(path), this.injector);

Callers

nothing calls this directly

Calls 2

ɵfirebaseAppFactoryFunction · 0.90
ɵcacheInstanceFunction · 0.90

Tested by

no test coverage detected