1.0.7 • Published 1 year ago

async-pool-limit v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

async-pool-limit

一个 promise 并发调度器(a promise based concurrent scheduler)

Install

npm i async-pool-limit
or
yarn add async-pool-limit
or
pnpm i async-pool-limit

option

paramdescriptiontype
limit最大并发数(Maximum number of concurrent )number
values源数据(Source Data)array
pCtor创建 promise 的函数(Functions for creating a promise)function
cb每个 promise 成功或者失败的回调(Callback after success or failure of each promise )function

Usage

import scheduler from 'async-pool-limit';

const timeout = time => {
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      resolve(time);
    }, time);
  });
};

scheduler({
  limit: 2,
  values: [10, 50, 30, 20],
  pCtor: timeout,
  cb: res => {
    console.log(res);
  },
});

// 10 30 50 20
1.0.7

1 year ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago