# async-waiter

> higher-level functions to simplify waiting for multiple concurrent async operations to finish

Latest version **0.1.1** (published 2014-12-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install async-waiter
pnpm add async-waiter
yarn add async-waiter
bun add async-waiter
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2014-12-08 |
| First published | 2014-12-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Nadav Ivgi |
| Maintainers | nadav |
| Keywords | async, waiter, wait, concurrent |

## Links

- npm: https://www.npmjs.com/package/async-waiter
- Repository: https://github.com/shesek/async-waiter
- Issues: https://github.com/shesek/async-waiter/issues
- npm.io page: https://npm.io/package/async-waiter

## Dependencies (1)

- [iferr](https://npm.io/package/iferr.md) ^0.1.5

## Alternatives

- [promise-throttle](https://npm.io/package/promise-throttle.md) — 44.2K weekly downloads
- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2014-12-08
- 0.1.0 — 2014-12-08

## README

# async-waiter

Higher-level functions to simplify waiting for multiple concurrent async
operations to finish.

### Install

    npm install --save async-waiter

### Example

```coffee

waiter = require 'waiter'

# Wait for `doFoo()` and `doBar()` to finish, then call `cb`
doFooAndBar = (cb) ->
  waiter (wait) ->
    doFoo wait()
    doBar wait()
  , cb

# Wait for all update() operations to finish
updateUsers = (user_ids, data, cb) ->
  waiter (wait) ->
    user_ids.forEach (user_id) ->
      User.update user_id, data, wait()
  , cb

# The wait() function can delegate to a provided callback,
# and the `this` context can be used to pass data to the callback
loadUserWithFriends = (user_id, cb) ->
  waiter (wait) ->
    User.loadUser user_id, wait (user) -> @data = user.data
    User.loadFriends user_id, wait (@friends) ->
  , (err, ctx) ->
    if err? then cb err
    else cb null, ctx.data, ctx.friends

````

### License
MIT

---
_Source: https://npm.io/package/async-waiter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
