Greasy Fork is available in English.

promise concurrency

基于promise 并发控制

ეს სკრიპტი არ უნდა იყოს პირდაპირ დაინსტალირებული. ეს ბიბლიოთეკაა, სხვა სკრიპტებისთვის უნდა ჩართეთ მეტა-დირექტივაში // @require https://update.greasyfork.org/scripts/488850/1336774/promise%20concurrency.js.

ავტორი
我想吃鱼
ვერსია
0.0.1.20240303042711
შექმნილია
03.03.2024
განახლებულია
03.03.2024
ლიცენზია
პ/გ

使用方法

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