| 20 | imports: [AsyncPipe] |
| 21 | }) |
| 22 | export class StorageComponent { |
| 23 | |
| 24 | private readonly storage = getStorage(inject(FirebaseApp)); |
| 25 | |
| 26 | private readonly transferState = inject(TransferState); |
| 27 | private readonly transferStateKey = makeStateKey<string|undefined>("storage:google-g.png"); |
| 28 | |
| 29 | private readonly icon = ref(this.storage, 'google-g.png'); |
| 30 | |
| 31 | protected readonly downloadUrl$ = from(getDownloadURL(this.icon)).pipe( |
| 32 | traceUntilFirst('storage'), |
| 33 | isPlatformServer(inject(PLATFORM_ID)) ? |
| 34 | tap(it => this.transferState.set(this.transferStateKey, it)) : |
| 35 | startWith(this.transferState.get(this.transferStateKey, TRANSPARENT_PNG)) |
| 36 | ); |
| 37 | |
| 38 | constructor() { |
| 39 | if (environment.emulatorPorts?.storage) { |
| 40 | connectStorageEmulator(this.storage, "localhost", environment.emulatorPorts.storage); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | } |
nothing calls this directly
no test coverage detected