MCPcopy Index your code
hub / github.com/NativeScript/firebase / Database

Class Database

packages/firebase-database/index.android.ts:634–709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

632}
633
634export class Database implements IDatabase {
635 _native: com.google.firebase.database.FirebaseDatabase;
636 _app: FirebaseApp;
637 constructor(app?: FirebaseApp) {
638 if (app?.native) {
639 this._native = com.google.firebase.database.FirebaseDatabase.getInstance(app.native);
640 } else {
641 if (defaultDatabase) {
642 return defaultDatabase;
643 }
644 defaultDatabase = this;
645 this._native = com.google.firebase.database.FirebaseDatabase.getInstance();
646 }
647 }
648
649 useEmulator(host: string, port: number) {
650 this.native.useEmulator(host === 'localhost' || host === '127.0.0.1' ? '10.0.2.2' : host, port);
651 }
652
653 _persistenceCacheSizeBytes = 10 * 1024 * 1024;
654 get persistenceCacheSizeBytes(): number {
655 return this._persistenceCacheSizeBytes;
656 }
657
658 set persistenceCacheSizeBytes(bytes) {
659 try {
660 this.native.setPersistenceCacheSizeBytes(bytes);
661 this._persistenceCacheSizeBytes = bytes;
662 } catch (e) {}
663 }
664 _persistenceEnabled = false;
665 get persistenceEnabled(): boolean {
666 return this._persistenceEnabled;
667 }
668 set persistenceEnabled(value) {
669 try {
670 this.native.setPersistenceEnabled(value);
671 this._persistenceEnabled = value;
672 } catch (e) {}
673 }
674
675 refFromURL(url: string): Reference {
676 return Reference.fromNative(this.native.getReferenceFromUrl(url));
677 }
678
679 setLoggingEnabled(enabled: boolean) {
680 this.native?.setLogLevel?.(enabled);
681 }
682
683 ref(path?: string): Reference {
684 return Reference.fromNative(this.native?.getReference?.(path || '/'));
685 }
686
687 goOffline() {
688 this.native.goOffline();
689 }
690
691 goOnline() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…