Skip to content

dygy/waitgroupjs

Repository files navigation

Advanced wait group for JS/TS (with types)

Installation

    npm i advanced_waitgroup_js

Usage

done

import WaitGroup from 'advanced_waitgroup_js'

const wg = new WaitGroup()

wg.add(2)

const p = wg.wait()

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

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

await p

ultimatum

import WaitGroup from 'advanced_waitgroup_js'

const wg = new WaitGroup()

wg.add(2)

const p = wg.wait()

setTimeout(() => {
    wg.ultimatum()
}, 3000)

await p

ttl and onOver

import WaitGroup from 'advanced_waitgroup_js'

const wg = new WaitGroup()

console.log(new Date())
wg.add(0, 20, alert('time passed for wait group'))
await wg.wait()
console.log(new Date())

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published