Skip to content

Commit fb4bd1c

Browse files
committed
Fix DataSnapshot size
1 parent 17e4ef3 commit fb4bd1c

File tree

2 files changed

+2
-2
lines changed
  • firebase-common/src/jsMain/kotlin/dev/gitlive/firebase/externals/database
  • firebase-database/src/jsMain/kotlin/dev/gitlive/firebase/database

2 files changed

+2
-2
lines changed

firebase-common/src/jsMain/kotlin/dev/gitlive/firebase/externals/database/database.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ external interface ThenableReference : DatabaseReference
115115

116116
external interface DataSnapshot {
117117
val key: String?
118+
val size: Int
118119
fun `val`(): Any
119120
fun exists(): Boolean
120121
fun forEach(action: (a: DataSnapshot) -> Boolean): Boolean
121-
fun numChildren(): Int
122122
fun child(path: String): DataSnapshot
123123
}
124124

firebase-database/src/jsMain/kotlin/dev/gitlive/firebase/database/database.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ actual class DataSnapshot internal constructor(val js: JsDataSnapshot) {
164164
actual fun child(path: String) = DataSnapshot(js.child(path))
165165

166166
actual val children: Iterable<DataSnapshot> = rethrow {
167-
ArrayList<DataSnapshot>(js.numChildren()).also {
167+
ArrayList<DataSnapshot>(js.size).also {
168168
js.forEach { snapshot -> it.add(DataSnapshot(snapshot)) }
169169
}
170170
}

0 commit comments

Comments
 (0)