asyncForeach:异步Foreach

时间:2021-06-24 16:31:39
【文件属性】:
文件名称:asyncForeach:异步Foreach
文件大小:25KB
文件格式:ZIP
更新时间:2021-06-24 16:31:39
JavaScript 异步Foreach asyncForeach([1, 2, 3], function(item, index, done) { setTimeout(function() { console.log(item); done(); }, 1000); }, function() { console.log('end'); }); 对于 asyncForeach,通过类比原生 Array.prototype.forEach 函数回调,我不检查。 如果用户没有提供——这是他自己的错,他将收到 undefined 不是一个函数。 对于 Array 以外的任何类型,不会执行一次迭代,我们将到达 endFn。 此外,Array.prototype.forEach 接收 thisArg 作为最后一个可选参数,我们现在不需要这个,所以没有实现。
【文件预览】:
asyncForeach-master
----.jshintrc(128B)
----index.html(370B)
----qunit()
--------qunit-1.17.1.js(70KB)
--------qunit-1.17.1.css(5KB)
----async-for-each.js(1KB)
----LICENSE(1KB)
----README.md(1KB)
----async-for-each-test.js(1KB)

网友评论