From 794441e731dc9aff8115581db2bfacd5da945764 Mon Sep 17 00:00:00 2001 From: Maneesh Tewani Date: Thu, 6 Jul 2023 10:34:32 -0700 Subject: [PATCH] Fixed docgen docsite (#7420) --- docs-devsite/database.datasnapshot.md | 8 ++--- docs-devsite/database.iterateddatasnapshot.md | 34 +++++++++++++++++++ docs-devsite/database.md | 1 + 3 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 docs-devsite/database.iterateddatasnapshot.md diff --git a/docs-devsite/database.datasnapshot.md b/docs-devsite/database.datasnapshot.md index 35e983def87..ef21a2a87e0 100644 --- a/docs-devsite/database.datasnapshot.md +++ b/docs-devsite/database.datasnapshot.md @@ -38,7 +38,7 @@ export declare class DataSnapshot | [child(path)](./database.datasnapshot.md#datasnapshotchild) | | Gets another DataSnapshot for the location at the specified relative path.Passing a relative path to the child() method of a DataSnapshot returns another DataSnapshot for the location at the specified relative path. The relative path can either be a simple child name (for example, "ada") or a deeper, slash-separated path (for example, "ada/name/first"). If the child location has no data, an empty DataSnapshot (that is, a DataSnapshot whose value is null) is returned. | | [exists()](./database.datasnapshot.md#datasnapshotexists) | | Returns true if this DataSnapshot contains any data. It is slightly more efficient than using snapshot.val() !== null. | | [exportVal()](./database.datasnapshot.md#datasnapshotexportval) | | Exports the entire contents of the DataSnapshot as a JavaScript object.The exportVal() method is similar to val(), except priority information is included (if available), making it suitable for backing up your data. | -| [forEach(action)](./database.datasnapshot.md#datasnapshotforeach) | | Enumerates the top-level children in the DataSnapshot.Because of the way JavaScript objects work, the ordering of data in the JavaScript object returned by val() is not guaranteed to match the ordering on the server nor the ordering of onChildAdded() events. That is where forEach() comes in handy. It guarantees the children of a DataSnapshot will be iterated in their query order.If no explicit orderBy*() method is used, results are returned ordered by key (unless priorities are used, in which case, results are returned by priority). | +| [forEach(action)](./database.datasnapshot.md#datasnapshotforeach) | | Enumerates the top-level children in the IteratedDataSnapshot.Because of the way JavaScript objects work, the ordering of data in the JavaScript object returned by val() is not guaranteed to match the ordering on the server nor the ordering of onChildAdded() events. That is where forEach() comes in handy. It guarantees the children of a DataSnapshot will be iterated in their query order.If no explicit orderBy*() method is used, results are returned ordered by key (unless priorities are used, in which case, results are returned by priority). | | [hasChild(path)](./database.datasnapshot.md#datasnapshothaschild) | | Returns true if the specified child path has (non-null) data. | | [hasChildren()](./database.datasnapshot.md#datasnapshothaschildren) | | Returns whether or not the DataSnapshot has any non-null child properties.You can use hasChildren() to determine if a DataSnapshot has any children. If it does, you can enumerate them using forEach(). If it doesn't, then either this snapshot contains a primitive value (which can be retrieved with val()) or it is empty (in which case, val() will return null). | | [toJSON()](./database.datasnapshot.md#datasnapshottojson) | | Returns a JSON-serializable representation of this object. | @@ -142,7 +142,7 @@ The DataSnapshot's contents as a JavaScript value (Object, Array, string, number ## DataSnapshot.forEach() -Enumerates the top-level children in the `DataSnapshot`. +Enumerates the top-level children in the `IteratedDataSnapshot`. Because of the way JavaScript objects work, the ordering of data in the JavaScript object returned by `val()` is not guaranteed to match the ordering on the server nor the ordering of `onChildAdded()` events. That is where `forEach()` comes in handy. It guarantees the children of a `DataSnapshot` will be iterated in their query order. @@ -151,14 +151,14 @@ If no explicit `orderBy*()` method is used, results are returned ordered by key Signature: ```typescript -forEach(action: (child: DataSnapshot) => boolean | void): boolean; +forEach(action: (child: IteratedDataSnapshot) => boolean | void): boolean; ``` ### Parameters | Parameter | Type | Description | | --- | --- | --- | -| action | (child: [DataSnapshot](./database.datasnapshot.md#datasnapshot_class)) => boolean \| void | A function that will be called for each child DataSnapshot. The callback can return true to cancel further enumeration. | +| action | (child: [IteratedDataSnapshot](./database.iterateddatasnapshot.md#iterateddatasnapshot_interface)) => boolean \| void | A function that will be called for each child DataSnapshot. The callback can return true to cancel further enumeration. | Returns: diff --git a/docs-devsite/database.iterateddatasnapshot.md b/docs-devsite/database.iterateddatasnapshot.md new file mode 100644 index 00000000000..1439a9d22ab --- /dev/null +++ b/docs-devsite/database.iterateddatasnapshot.md @@ -0,0 +1,34 @@ +Project: /docs/reference/js/_project.yaml +Book: /docs/reference/_book.yaml +page_type: reference + +{% comment %} +DO NOT EDIT THIS FILE! +This is generated by the JS SDK team, and any local changes will be +overwritten. Changes should be made in the source code at +https://github.com/firebase/firebase-js-sdk +{% endcomment %} + +# IteratedDataSnapshot interface +Represents a child snapshot of a `Reference` that is being iterated over. The key will never be undefined. + +Signature: + +```typescript +export declare interface IteratedDataSnapshot extends DataSnapshot +``` +Extends: [DataSnapshot](./database.datasnapshot.md#datasnapshot_class) + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [key](./database.iterateddatasnapshot.md#iterateddatasnapshotkey) | string | | + +## IteratedDataSnapshot.key + +Signature: + +```typescript +key: string; +``` diff --git a/docs-devsite/database.md b/docs-devsite/database.md index 686ca7f8580..0b8d6509e8e 100644 --- a/docs-devsite/database.md +++ b/docs-devsite/database.md @@ -94,6 +94,7 @@ Firebase Realtime Database | Interface | Description | | --- | --- | | [DatabaseReference](./database.databasereference.md#databasereference_interface) | A DatabaseReference represents a specific location in your Database and can be used for reading or writing data to that Database location.You can reference the root or child location in your Database by calling ref() or ref("child/path").Writing is done with the set() method and reading can be done with the on*() method. See [https://firebase.google.com/docs/database/web/read-and-write](https://firebase.google.com/docs/database/web/read-and-write) | +| [IteratedDataSnapshot](./database.iterateddatasnapshot.md#iterateddatasnapshot_interface) | Represents a child snapshot of a Reference that is being iterated over. The key will never be undefined. | | [ListenOptions](./database.listenoptions.md#listenoptions_interface) | An options objects that can be used to customize a listener. | | [Query](./database.query.md#query_interface) | A Query sorts and filters the data at a Database location so only a subset of the child data is included. This can be used to order a collection of data by some attribute (for example, height of dinosaurs) as well as to restrict a large list of items (for example, chat messages) down to a number suitable for synchronizing to the client. Queries are created by chaining together one or more of the filter methods defined here.Just as with a DatabaseReference, you can receive data from a Query by using the on*() methods. You will only receive events and DataSnapshots for the subset of the data that matches your query.See [https://firebase.google.com/docs/database/web/lists-of-data\#sorting\_and\_filtering\_data](https://firebase.google.com/docs/database/web/lists-of-data#sorting_and_filtering_data) for more information. | | [ThenableReference](./database.thenablereference.md#thenablereference_interface) | A Promise that can also act as a DatabaseReference when returned by [push()](./database.md#push). The reference is available immediately and the Promise resolves as the write to the backend completes. |