Skip to content

Commit 77dc1ba

Browse files
committed
fix
1 parent f80dc03 commit 77dc1ba

File tree

1 file changed

+5
-7
lines changed
  • 1-js/12-generators-iterators/2-async-iterators-generators

1 file changed

+5
-7
lines changed

1-js/12-generators-iterators/2-async-iterators-generators/article.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -345,20 +345,18 @@ When we expect the data to come asynchronously, with delays, their async counter
345345
346346
Syntax differences between async and regular iterators:
347347
348-
| | Iterators | Async iterators |
348+
| | Iterable | Async Iterable |
349349
|-------|-----------|-----------------|
350-
| Object method to provide iterator | `Symbol.iterator` | `Symbol.asyncIterator` |
351-
| `next()` return value is | any value | `Promise` |
350+
| Method to provide iterator | `Symbol.iterator` | `Symbol.asyncIterator` |
351+
| `next()` return value is | `{value:…, done: true/false}` | `Promise` that resolves to `{value:…, done: true/false}` |
352352
353353
Syntax differences between async and regular generators:
354354
355355
| | Generators | Async generators |
356356
|-------|-----------|-----------------|
357357
| Declaration | `function*` | `async function*` |
358-
| `generator.next()` returns | `{value:…, done: true/false}` | `Promise` that resolves to `{value:…, done: true/false}` |
358+
| `next()` return value is | `{value:…, done: true/false}` | `Promise` that resolves to `{value:…, done: true/false}` |
359359
360360
In web-development we often meet streams of data, when it flows chunk-by-chunk. For instance, downloading or uploading a big file.
361361
362-
We can use async generators to process such data, but it's also worth to mention that there's also another API called Streams, that provides special interfaces to work with such streams, to transform the data and to pass it from one stream to another (e.g. download from one place and immediately send elsewhere).
363-
364-
Streams API is not a part of JavaScript language standard.
362+
We can use async generators to process such data. It's also noteworthy that in some environments, such as browsers, there's also another API called Streams, that provides special interfaces to work with such streams, to transform the data and to pass it from one stream to another (e.g. download from one place and immediately send elsewhere).

0 commit comments

Comments
 (0)