0.0.4 • Published 2 years ago

@kojiro.ueda/promise-pool v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

promise-pool

PromisePool creates a pool that limits the number of concurrent JavaScript operations using Promise.

how to use

import { PromisePool } from "https://deno.land/x/promise_pool@0.0.3/index.ts";

const pool = new PromisePool({ concurrency: 2 /* default 1 */ });

await Promise.all([
  pool.open(async () => {
    console.log("running 1")
    // some async process.
  }),
  pool.open(async () => {
    console.log("running 2")
    // some async process.
  }),
  pool.open(async () => {
    console.log("running 3")
    // some async process.
  }),
  pool.open(async () => {
    // some async process.
    console.log("running 4")
  }),
]);

console.log("done!")
0.0.4

2 years ago

0.0.3

2 years ago