# task-waiter

> Wait a task is completed

Latest version **0.1.1** (published 2018-08-29) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2018-08-29 |
| First published | 2018-08-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kengo Nakatsuka |
| Maintainers | nak2k |

## Links

- npm: https://www.npmjs.com/package/task-waiter
- Repository: https://github.com/nak2k/node-task-waiter
- Issues: https://github.com/nak2k/node-task-waiter/issues
- npm.io page: https://npm.io/package/task-waiter

## Recent versions

- 0.1.1 (latest) — 2018-08-29
- 0.1.0 — 2018-08-25

## README

# task-waiter

Wait a task is completed.

## Installation

```
npm i task-waiter
```

## Usage

``` javascript
const { wait } = require('task-waiter');

const then = wait(callback => {
  // Do something

  callback(null, 1, 2, 3);
});

then((err, ...args) => {
  // args is [1, 2, 3]
});
```

## wait(task)

- `task(callback)`
    - A task funciton to wait for completion.
    - The `callback` function must be called with any number of arguments when the task is completed.

This function returns a following function:

- `then(callback)`
    - A function to specify a function that is called after the task is completed.
    - The `callback` function is called with arguments that are passed when the callback of the task is called.

## lazy(task)

This function can be called the same as `wait(task)` except the task is called after the first `then` function call.

## License

MIT

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