目录
当前位置: 首页 > 文档资料 > Lazy.js 英文文档 >

Iterator

优质
小牛编辑
129浏览
2023-12-01

The Iterator object provides an API for iterating over a sequence.

The purpose of the Iterator type is mainly to offer an agnostic way of iterating over a sequence -- either synchronous (i.e. with a while loop) or asynchronously (with recursive calls to either setTimeout or --- if available --- setImmediate). It is not intended to be used directly by application code.

Signature

function Iterator(sequence) { /*...*/ }
function Iterator(sequence) {
  this.sequence = sequence;
  this.index    = -1;
}
NameType(s)Description
sequenceSequence

The sequence to iterate over.