0.0.7 • Published 5 years ago

@dot-event/wait v0.0.7

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

@dot-event/wait

dot-event async wait

wait

Install

npm install dot-event @dot-event/wait

Setup

const dot = require("dot-event")()
require("@dot-event/wait")(dot)

Usage

Wait for two async processes to call dot.wait:

async function test() {
  await dot.wait({ count: 2 })
}

await test() // never finishes

await Promise.all([test(), test()]) // finishes

Why?

Sometimes you want to call the same function multiple times asynchronously, and you want each call to wait for certain "checkpoints" across all calls.

As long as you know how many total calls there are (count), you can wait for each call to reach dot.wait before continuing.

Each dot.wait must receive a unique prop to begin a new counter.

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago