# wait-for

> Tiny callback counter

Latest version **2.1.1** (published 2014-10-27) · ISC license · 0 weekly downloads

## Install

```sh
npm install wait-for
pnpm add wait-for
yarn add wait-for
bun add wait-for
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.1 |
| Published | 2014-10-27 |
| First published | 2014-07-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | korynunn |

## Links

- npm: https://www.npmjs.com/package/wait-for
- Repository: https://github.com/KoryNunn/wait-for
- Issues: https://github.com/KoryNunn/wait-for/issues
- npm.io page: https://npm.io/package/wait-for

## Dependencies (1)

- [grape](https://npm.io/package/grape.md) ^1.0.0

## Recent versions

- 2.1.1 (latest) — 2014-10-27
- 2.1.0 — 2014-10-27
- 2.0.0 — 2014-10-27
- 1.0.0 — 2014-07-02

## README

# wait-for

Tiny callback counting module to run a function when all watched functions have completed

## Usage

set up what you want to do after async things have happened:

    var after = waitFor(done);

Wait for things:

    fs.readFile('bla', after(function(){
        ...

        fs.readFile('blee', after(function(){
            ...
        });
    });

done will only be called after all wrapped async calls are complete.

If any task errors, no other tasks will be called, but those in flight will call back. The error will be passed to ```done```:

    function done(error){
        // called if any error occurs, or if all tasks succeded
    });

You can specify that the fn will not error (or you don't care if if does) by passing true as the first parameter:

    after(true, function(){...})

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