<commit_before># WaitForAll and WaitForAny for Node.js EventEmitter [![Build Status](https://secure.travis-ci.org/MathieuTurcotte/node-wait.png)](http://travis-ci.org/MathieuTurcotte/node-wait)

WaitForAll and WaitForAny on EventEmitter instances.

## Installation

```
npm install ewait
```
<commit_msg>Updated README.<commit_after># WaitForAll and WaitForAny for Node.js EventEmitter [![Build Status](https://secure.travis-ci.org/MathieuTurcotte/node-wait.png)](http://travis-ci.org/MathieuTurcotte/node-wait)

WaitForAll and WaitForAny on EventEmitter instances.

## Installation

```
npm install ewait
```
## Usage

`WaitForAny` and `WaitForAll` wait until one or all of the specified
`EventEmitter` are done or the timeout interval elapses.

Upon successful completion, a `done` event is emitted by the `WaitForAll` or
`WaitForAny` instance. On timeout, a `timeout` event is emitted.

By default, `WaitForAny` and `WaitForAll` will listen for the `done` event.
This behavior can be altered by specifying a custom event type.

## Example

``` js
var all = new WaitForAll({
    timeout: 2000,      // Wait for 2000ms max.
    event: 'flushed'    // Wait for a custom event.
});

all.add([toilet1, toilet2, toilet2]);

all.once('done', function() {
    console.log('All done!');
});

all.once('timeout', function() {
    console.log('Timeout!');
});

all.wait();
```


{'fraction_non_alphanumeric': 0.13576642335766423, 'fraction_numerical': 0.008029197080291971, 'mean_word_length': 4.595918367346939, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3033474', 'n_tokens_mistral': 461, 'n_tokens_neox': 444, 'n_words': 132}