async
优质
小牛编辑
130浏览
2023-12-01
Creates a sequence, with the same elements as this one, that will be iterated over asynchronously when calling each
.
Signature
Sequence.async = function(interval) { /*...*/ }
Sequence.async = function async(interval) { return new AsyncSequence(this, interval); }
Name | Type(s) | Description |
---|---|---|
interval | number? | The approximate period, in milliseconds, that should elapse between each element in the resulting sequence. Omitting this argument will result in the fastest possible asynchronous iteration. |
returns | AsyncSequence | The new asynchronous sequence. |
Examples
Lazy([1, 2, 3]).async(100).each(fn) // calls fn 3 times asynchronously