You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
Copy file name to clipboardExpand all lines: SPEC/MISCELLANEOUS.md
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,9 +111,9 @@ Where:
111
111
112
112
| Type | Description |
113
113
| -------- | -------- |
114
-
|`Promise<Array>`| An array of ping response objects |
114
+
|`AsyncIterable<Object>`| An async iterable that yields ping response objects |
115
115
116
-
an array of objects is returned, each of the form:
116
+
Each yielded object is of the form:
117
117
118
118
```js
119
119
{
@@ -128,14 +128,13 @@ Note that not all ping response objects are "pongs". A "pong" message can be ide
128
128
**Example:**
129
129
130
130
```JavaScript
131
-
constresponses=awaitipfs.ping('Qmhash')
132
-
responses.forEach((res) => {
131
+
forawait (constresofipfs.ping('Qmhash')) {
133
132
if (res.time) {
134
133
console.log(`Pong received: time=${res.time} ms`)
135
134
} else {
136
135
console.log(res.text)
137
136
}
138
-
})
137
+
}
139
138
```
140
139
141
140
A great source of [examples](https://github.com/ipfs/interface-ipfs-core/tree/master/src/ping) can be found in the tests for this API.
0 commit comments