MCPcopy Create free account
hub / github.com/NativeScript/firebase / Database

Class Database

packages/firebase-database/index.ios.ts:616–687  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

614}
615
616export class Database implements IDatabase {
617 _native: FIRDatabase;
618 _app: FirebaseApp;
619
620 constructor(app?: FirebaseApp) {
621 if (app?.native) {
622 this._native = FIRDatabase.databaseForApp(app.native);
623 } else {
624 if (defaultDatabase) {
625 return defaultDatabase;
626 }
627 defaultDatabase = this;
628 this._native = FIRDatabase.database();
629 }
630 }
631
632 useEmulator(host: string, port: number) {
633 this.native.useEmulatorWithHostPort(host, port);
634 }
635
636 get persistenceCacheSizeBytes(): number {
637 return this.native.persistenceCacheSizeBytes;
638 }
639
640 set persistenceCacheSizeBytes(bytes) {
641 this.native.persistenceCacheSizeBytes = bytes;
642 }
643
644 get persistenceEnabled(): boolean {
645 return this.native.persistenceEnabled;
646 }
647
648 set persistenceEnabled(value) {
649 this.native.persistenceEnabled = value;
650 }
651
652 refFromURL(url: string): Reference {
653 return Reference.fromNative(this.native?.referenceFromURL?.(url));
654 }
655
656 setLoggingEnabled(enabled: boolean) {
657 FIRDatabase.setLoggingEnabled(enabled);
658 }
659
660 ref(path?: string): Reference {
661 return Reference.fromNative(this.native?.referenceWithPath?.(path || '/'));
662 }
663
664 goOffline() {
665 this.native.goOffline();
666 }
667
668 goOnline() {
669 this.native.goOnline();
670 }
671
672 get native() {
673 return this._native;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected