diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/javascript/reference/global_objects/asynciterator | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/asynciterator')
-rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/asynciterator/index.html | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/asynciterator/index.html b/files/zh-cn/web/javascript/reference/global_objects/asynciterator/index.html new file mode 100644 index 0000000000..9c14e462bd --- /dev/null +++ b/files/zh-cn/web/javascript/reference/global_objects/asynciterator/index.html @@ -0,0 +1,119 @@ +--- +title: AsyncIterator +slug: Web/JavaScript/Reference/Global_Objects/AsyncIterator +tags: + - 异步迭代器 + - 类 +translation_of: Web/JavaScript/Reference/Global_Objects/AsyncIterator +--- +<p>{{JSRef}}{{Draft}}</p> + +<p><strong><code>AsyncIterator</code></strong> 全局对象是一个提供辅助方法的抽象类,与暴露在{{JSxRef("Array")}} 实例上的那些类似。</p> + +<h2 id="构造函数">构造函数</h2> + +<dl> + <dt>{{JSxRef("AsyncIterator.AsyncIterator", "AsyncIterator()")}} </dt> + <dd>一个抽象构造函数,仅能够通过 {{JSxRef("Operators/super", "super()")}} 来调用。</dd> +</dl> + +<h2 id="属性">属性</h2> + +<dl> + <dt><code>AsyncIterator.prototype</code></dt> + <dd><code>%AsyncIteratorPrototype%</code> 内部对象。</dd> +</dl> + +<h2 id="方法">方法</h2> + +<dl> + <dt>{{JSxRef("AsyncIterator.from()")}} </dt> + <dd>等同于在传入的对象上调用 <code>@@asyncIterator</code> 。</dd> +</dl> + +<h2 id="AsyncIterator_原型"><code>AsyncIterator</code> 原型</h2> + +<h3 id="原型属性">原型属性</h3> + +<dl> + <dt><code>AsyncIterator.prototype.constructor</code></dt> + <dd>指定创建对的象原型的函数.</dd> + <dt><code>AsyncIterator.prototype[@@toStringTag]</code> </dt> + <dd><code>字符串 "Iterator"</code>.</dd> +</dl> + +<h3 id="原型方法">原型方法</h3> + +<dl> + <dt>{{JSxRef("AsyncIterator.prototype.map()")}} </dt> + <dd>...</dd> + <dt>{{JSxRef("AsyncIterator.prototype.filter()")}} </dt> + <dd>...</dd> + <dt>{{JSxRef("AsyncIterator.prototype.take()")}} </dt> + <dd>...</dd> + <dt>{{JSxRef("AsyncIterator.prototype.drop()")}} </dt> + <dd>...</dd> + <dt>{{JSxRef("AsyncIterator.prototype.asIndexedPairs()")}} </dt> + <dd>...</dd> + <dt>{{JSxRef("AsyncIterator.prototype.flatMap()")}} </dt> + <dd>...</dd> + <dt>{{JSxRef("AsyncIterator.prototype.reduce()")}} </dt> + <dd>...</dd> + <dt>{{JSxRef("AsyncIterator.prototype.toArray()")}} </dt> + <dd>...</dd> + <dt>{{JSxRef("AsyncIterator.prototype.forEach()")}} </dt> + <dd>...</dd> + <dt>{{JSxRef("AsyncIterator.prototype.some()")}} </dt> + <dd>...</dd> + <dt>{{JSxRef("AsyncIterator.prototype.every()")}} </dt> + <dd>...</dd> + <dt>{{JSxRef("AsyncIterator.prototype.find()")}} </dt> + <dd>...</dd> + <dt>{{JSxRef("AsyncIterator.prototype.@@iterator()", "AsyncIterator.prototype[@@iterator]()")}}</dt> + <dd>返回该 <code>AsyncIterator</code> 实例。</dd> +</dl> + +<h2 id="实现方法">实现方法</h2> + +<dl> + <dt>{{JSxRef("AsyncIterator.prototype.next()", "<<var>implementation</var>>.prototype.next()")}}</dt> + <dd>获取 <code>AsyncIterator</code> 中的下一项</dd> + <dt>{{JSxRef("AsyncIterator.prototype.return()", "<<var>implementation</var>>.prototype.next()")}}{{Optional_Inline}}</dt> + <dd>返回给出的值,并结束迭代。</dd> + <dt>{{JSxRef("AsyncIterator.prototype.throw()", "<<var>implementation</var>>.prototype.next()")}}{{Optional_Inline}}</dt> + <dd>抛出一个迭代器错误(同时也终止了迭代器,除非是在该迭代器内部被捕获)。</dd> +</dl> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td><a href="https://tc39.es/proposal-iterator-helpers/#sec-asynciterator-constructor">ESNext Iterator Helpers Proposal</a></td> + <td><span class="spec-Draft">Stage 2 Draft</span></td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("javascript.builtins.AsyncIterator")}}</p> + +<h2 id="另请参阅">另请参阅</h2> + +<ul> + <li>{{JSxRef("Iteration_protocols", "Iteration protocols", "", "1")}}</li> + <li>{{JSxRef("Generator")}}</li> + <li>{{JSxRef("Global_Objects/AsyncGenerator", "AsyncGenerator")}}</li> + <li>{{JSxRef("Iterator")}} </li> +</ul> |