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

Class DataSnapshot

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

Source from the content-addressed store, hash-verified

531}
532
533export class DataSnapshot implements IDataSnapshot {
534 _native: FIRDataSnapshot;
535
536 static fromNative(snapshot: FIRDataSnapshot) {
537 if (snapshot instanceof FIRDataSnapshot) {
538 const ss = new DataSnapshot();
539 ss._native = snapshot;
540 return ss;
541 }
542 return null;
543 }
544
545 get native() {
546 return this._native;
547 }
548
549 get ios() {
550 return this.native;
551 }
552
553 get key(): string {
554 return this.native?.key;
555 }
556
557 get ref(): Reference {
558 return Reference.fromNative(this.native.ref);
559 }
560
561 child(path: string): DataSnapshot {
562 return DataSnapshot.fromNative(this.native.childSnapshotForPath(path));
563 }
564
565 exists(): boolean {
566 return this.native?.exists();
567 }
568
569 exportVal() {
570 return {
571 '.priority': this.native.priority,
572 '.value': deserialize(this.native.value),
573 };
574 }
575
576 forEach(action: (child: DataSnapshot) => true | undefined): boolean {
577 let didStop = false;
578 const children = this.native.children;
579 let object = children.nextObject();
580 while (object) {
581 didStop = action(DataSnapshot.fromNative(object));
582 if (didStop || !object) {
583 break;
584 }
585 object = children.nextObject();
586 }
587 if (didStop) {
588 return true;
589 }
590 if (!object) {

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…