# after-all-results

> Bundle results of async functions calls into one callback with all the results

Latest version **2.0.0** (published 2015-01-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install after-all-results
pnpm add after-all-results
yarn add after-all-results
bun add after-all-results
```

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2015-01-31 |
| First published | 2014-08-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/after-all-results) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Thomas Watson Steen |
| Maintainers | watson |
| Keywords | parallel, callback, async, done |

## Links

- npm: https://www.npmjs.com/package/after-all-results
- Repository: https://github.com/watson/after-all-results
- Issues: https://github.com/watson/after-all-results/issues
- npm.io page: https://npm.io/package/after-all-results

## Alternatives

- [@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
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2015-01-31
- 1.1.0 — 2014-08-16
- 1.0.0 — 2014-08-16

## README

# after-all-results

If you have multiple async function calls that you want to run in
parallel and collect all their results in an array, this is the module
for you.

It's like [after-all](https://github.com/sorribas/after-all) with a
build in results aggregator.

[![build status](https://secure.travis-ci.org/watson/after-all-results.png)](http://travis-ci.org/watson/after-all-results)

## Installation

```
npm install after-all-results
```

## Usage

First require the module:

```javascript
var afterAll = require('after-all-results');
```

Then initialize with a callback that should be called once all the async
stuff is done:

```javascript
var next = afterAll(function (err, results) {
  // all done!
  console.log(results);
});
```

The returned `next` function is essentially just a smart
callback-generator. The after-all-results module will wait and not call
the all-done function until all the generated callbacks have been
called:

```javascript
someAsyncFunction(next());
anotherAsyncFunction(next());
```

**Note:** It is important that all `next()` calls are done on the same
tick as the inital call to `afterAll()`!

### Bonus: Inception mode

```javascript
var next = afterAll(function (err, results) {
  // results will be an array of `arg1` from below
  console.log('Done with everything!');
});

async(next(function (err, arg1, arg2) {
  console.log('Done with first call to async');
});

async(next(function (err, arg1, arg2) {
  console.log('Done with second call to async');
});
```

## License

MIT

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