Greasy Fork is available in English.

promise concurrency

基于promise 并发控制

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.greasyfork.org/scripts/488850/1336774/promise%20concurrency.js


作者
我想吃鱼
版本
0.0.1.20240303042711
创建于
2024-03-03
更新于
2024-03-03
大小
977 字节
许可证
暂无

使用方法

await concurrentTasks(5, [1, 2, 3, 4], (n) => {
return new Promise((ok) => {
setTimeout(() => {
console.log(n);
ok();
}, Math.random() * 5000);
});
});