- From: Mattias Buelens <notifications@github.com>
- Date: Tue, 30 Jul 2024 06:24:42 -0700
- To: whatwg/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/webidl/pull/1397/review/2207681405@github.com>
@MattiasBuelens commented on this pull request.
> + [=JS async iterable/method=] set to |method|, and [=JS async iterable/type=] set to
+ "<code>async</code>".
+</div>
+
+<div id="async-iterable-to-js" algorithm="convert an async iterable to a JavaScript value">
+ An IDL <a lt="async iterable type">async iterable<<var ignore>T</var>></a> value |V| is
+ [=converted to a JavaScript value|converted=] to a JavaScript object as follows:
+
+ 1. Return |V|'s [=JS async iterable/object=].
+</div>
+
+<h5 id="js-async-iterator">Async iterators</h5>
+
+<dfn lt="async iterator" export>Async iterator</dfn> values are represented by a [=struct=] with the following [=struct/items=]:
+
+* <dfn for="JS async iterator">underlying record</dfn>, a [=Iterator=] record
```suggestion
* <dfn for="JS async iterator">underlying record</dfn>, an [=Iterator=] record
```
> +
+<h5 id="js-async-iterator-iteration">Iterating async iterators</h5>
+
+[=Async iterables=] are not directly iterated over. They are first opened, to create a new
+[=async iterator=], and then the [=async iterator=] is iterated over.
+
+<div algorithm>
+
+ To <dfn id="async-iterable-open" export lt="open an async iterable">open</dfn> an
+ <code><a lt="async iterable type">async iterable<<var>T</var>></a></code> |iterable|:
+
+ 1. Let |iterator| be [=?=] <a abstract-op>GetIteratorFromMethod</a>(|iterable|'s
+ [=JS async iterable/object=], |iterable|'s [=JS async iterable/method=]).
+ 1. If |iterable|'s [=JS async iterable/type=] is "<code>sync</code>", set |iterator| to
+ <a abstract-op>CreateAsyncFromSyncIterator</a>(|iterator|).
+ 1. Return a [=async iterator=] value with [=JS async iterator/underlying record=] set to |iterator| and
```suggestion
1. Return an [=async iterator=] value with [=JS async iterator/underlying record=] set to |iterator| and
```
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/pull/1397#pullrequestreview-2207681405
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/webidl/pull/1397/review/2207681405@github.com>
Received on Tuesday, 30 July 2024 13:24:46 UTC