npm.io
0.3.1 • Published 6 years ago

wait-group-promise

Licence
MIT
Version
0.3.1
Deps
1
Size
7 kB
Vulns
0
Weekly
0
Stars
7

wait-group-promise

An implementation of the Go's WaitGroup for Node.js.

Installation

npm install --save wait-group-promise

Usage

const WaitGroup = require('wait-group-promise');

const wg = new WaitGroup();

wg.add(2);

const p = wg.wait();

setTimeout(() => {
  wg.done();
}, 5000);
  
setTimeout(() => {
  wg.done();
}, 3000);

await p;

Keywords