# nd-queue

> 简单的队列执行控制

Latest version **3.0.0** (published 2016-02-13) · 0 weekly downloads

## Install

```sh
npm install nd-queue
pnpm add nd-queue
yarn add nd-queue
bun add nd-queue
```

## 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 | 3.0.0 |
| Published | 2016-02-13 |
| First published | 2016-01-13 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | crossjs |
| Maintainers | crossjs |

## Links

- npm: https://www.npmjs.com/package/nd-queue
- Repository: https://github.com/ndfront/nd-queue
- Issues: https://github.com/ndfront/nd-queue/issues
- npm.io page: https://npm.io/package/nd-queue

## Recent versions

- 3.0.0 (latest) — 2016-02-13
- 1.0.0 — 2016-01-13

## README

# nd-queue

[![Travis](https://img.shields.io/travis/ndfront/nd-queue.svg?style=flat-square)](https://github.com/ndfront/nd-queue)
[![Coveralls](https://img.shields.io/coveralls/ndfront/nd-queue.svg?style=flat-square)](https://github.com/ndfront/nd-queue)
[![NPM version](https://img.shields.io/npm/v/nd-queue.svg?style=flat-square)](https://npmjs.org/package/nd-queue)

> 简单的队列执行控制。

## 安装

```bash
$ npm install nd-queue --save
```

## 使用

特殊用法，混入到类中

```js
// mixin to classes

var Queue = require('nd-queue');

var WidgetHasQueue = Widget.extend({

  // 使用 handlebars
  Implements: [Queue]

  ...
});
```

### run

synchronous. run queue member step by step (one invokes by previous one with `done`).

```js
var queue = new Queue()

// use function
queue.use(function([arg1, arg2, ...], done, fail){
  // do some (a)sync job, then
  done()
})

// use functions
queue.use([function([arg1, arg2, ...], done, fail){
  // do some (a)sync job, then
  done()
}, ...])

// use function with context key (defaults: 'ctx')
queue.use(function([arg1, arg2, ...], done, fail){
  // do some (a)sync job, then
  done()
}, 'upload')

// dynamically pass arguments to queue members
queue.run([arg1, arg2, ... ], [function callback([arg1, arg2, ... ]) {
  // do some jobs for done
}], [function callback([arg1, arg2, ... ]) {
  // do some jobs for fail
}])
```

### any

asynchronous. if any member of the queue is finished, call the callback for done, otherwise call the callback for fail.

### all

asynchronous. if all members of the queue is finished, call the callback for done, otherwise call the callback for fail.

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