@rmw/pool

0.0.21 • Public • Published

@rmw/pool

promise pool

安装

yarn add @rmw/pool

或者

npm install @rmw/pool

使用

#!/usr/bin/env coffee

import Pool from '@rmw/pool'
import sleep from 'await-sleep'

pool = Pool 5

job = (n)=>
  console.log n
  await sleep 100*n
  console.log 'done\t',n

n = 0
while ++n<10
 await pool job,n

await pool.done

关于

本项目隶属于人民网络(rmw.link) 代码计划。

人民网络

Readme

Keywords

none

Package Sidebar

Install

npm i @rmw/pool

Weekly Downloads

2

Version

0.0.21

License

AGPL

Unpacked Size

11.9 kB

Total Files

5

Last publish

Collaborators

  • gcxfd