| 562 | } |
| 563 | |
| 564 | export class Storage implements IStorage { |
| 565 | _native: FIRStorage; |
| 566 | _app: FirebaseApp; |
| 567 | |
| 568 | constructor(app?: FirebaseApp) { |
| 569 | if (app?.native) { |
| 570 | this._native = FIRStorage.storageForApp(app.native); |
| 571 | } else { |
| 572 | if (defaultStorage) { |
| 573 | return defaultStorage; |
| 574 | } |
| 575 | defaultStorage = this; |
| 576 | this._native = FIRStorage.storage(); |
| 577 | } |
| 578 | } |
| 579 | |
| 580 | static fromNative(storage: FIRStorage) { |
| 581 | if (storage instanceof FIRStorage) { |
| 582 | const store = new Storage(); |
| 583 | store._native = storage; |
| 584 | return store; |
| 585 | } |
| 586 | return null; |
| 587 | } |
| 588 | |
| 589 | useEmulator(host: string, port: number) { |
| 590 | this.native.useEmulatorWithHostPort(host, port); |
| 591 | } |
| 592 | |
| 593 | ref(path?: string): Reference { |
| 594 | return Reference.fromNative(this.native.referenceWithPath(path || '/')); |
| 595 | } |
| 596 | |
| 597 | refFromURL(url: string): Reference { |
| 598 | return Reference.fromNative(this.native.referenceForURL(url)); |
| 599 | } |
| 600 | |
| 601 | get native() { |
| 602 | return this._native; |
| 603 | } |
| 604 | |
| 605 | get ios() { |
| 606 | return this.native; |
| 607 | } |
| 608 | |
| 609 | get app(): FirebaseApp { |
| 610 | if (!this._app) { |
| 611 | // @ts-ignore |
| 612 | this._app = FirebaseApp.fromNative(this.native.app); |
| 613 | } |
| 614 | return this._app; |
| 615 | } |
| 616 | |
| 617 | get maxDownloadRetryTime(): number { |
| 618 | return this.native?.maxDownloadRetryTime; |
| 619 | } |
| 620 | |
| 621 | set maxDownloadRetryTime(value) { |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…