AsyncIterator
草案
本页尚未完工.
AsyncIterator
全局对象是一个提供辅助方法的抽象类,与暴露在Array
实例上的那些类似。
构造函数
AsyncIterator()
- 一个抽象构造函数,仅能够通过
super()
来调用。
属性
AsyncIterator.prototype
%AsyncIteratorPrototype%
内部对象。
方法
AsyncIterator.from()
- 等同于在传入的对象上调用
@@asyncIterator
。
AsyncIterator
原型
原型属性
AsyncIterator.prototype.constructor
- 指定创建对的象原型的函数.
AsyncIterator.prototype[@@toStringTag]
字符串 "Iterator"
.
原型方法
AsyncIterator.prototype.map()
- ...
AsyncIterator.prototype.filter()
- ...
AsyncIterator.prototype.take()
- ...
AsyncIterator.prototype.drop()
- ...
AsyncIterator.prototype.asIndexedPairs()
- ...
AsyncIterator.prototype.flatMap()
- ...
AsyncIterator.prototype.reduce()
- ...
AsyncIterator.prototype.toArray()
- ...
AsyncIterator.prototype.forEach()
- ...
AsyncIterator.prototype.some()
- ...
AsyncIterator.prototype.every()
- ...
AsyncIterator.prototype.find()
- ...
AsyncIterator.prototype[@@iterator]()
- 返回该
AsyncIterator
实例。
实现方法
<implementation>.prototype.next()
- 获取
AsyncIterator
中的下一项 <implementation>.prototype.next()
可选- 返回给出的值,并结束迭代。
<implementation>.prototype.next()
可选- 抛出一个迭代器错误(同时也终止了迭代器,除非是在该迭代器内部被捕获)。
规范
Specification | Status | Comment |
---|---|---|
ESNext Iterator Helpers Proposal | Stage 2 Draft | Initial definition |
浏览器兼容性
BCD tables only load in the browser