# asyncemit

> Asynchronously emit event an event based on the arguments length.

Latest version **3.0.1** (published 2015-05-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install asyncemit
pnpm add asyncemit
yarn add asyncemit
bun add asyncemit
```

## 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.1 |
| Published | 2015-05-12 |
| First published | 2015-03-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Arnout Kazemier |
| Maintainers | 3rdeden, lpinca |
| Keywords | async, emit, event, emitter, eventemitter, asyncemit |

## Links

- npm: https://www.npmjs.com/package/asyncemit
- Repository: https://github.com/primus/asyncemit
- Issues: https://github.com/primus/asyncemit/issues
- npm.io page: https://npm.io/package/asyncemit

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 3.0.1 (latest) — 2015-05-12
- 3.0.0 — 2015-05-12
- 2.0.0 — 2015-04-27
- 1.0.2 — 2015-04-01
- 1.0.1 — 2015-03-30
- 1.0.0 — 2015-03-30

## README

# asyncemit

[![Version npm](http://img.shields.io/npm/v/asyncemit.svg?style=flat-square)](http://browsenpm.org/package/asyncemit)[![Build Status](http://img.shields.io/travis/primus/asyncemit/master.svg?style=flat-square)](https://travis-ci.org/primus/asyncemit)[![Dependencies](https://img.shields.io/david/primus/asyncemit.svg?style=flat-square)](https://david-dm.org/primus/asyncemit)[![Coverage Status](http://img.shields.io/coveralls/primus/asyncemit/master.svg?style=flat-square)](https://coveralls.io/r/primus/asyncemit?branch=master)[![IRC channel](http://img.shields.io/badge/IRC-irc.freenode.net%23primus-00a8ff.svg?style=flat-square)](http://webchat.freenode.net/?channels=primus)

The `asyncemit` allows you to emit an event to an EventEmitter3 asynchronously.

## Installation

The module is released in the public npm registry and can be installed using:

```
npm install --save asyncemit
```

## Usage

To make this pattern work there are a couple of preconditions that need to be
satisfied:

1. The method should be added on either a class that inherits from the
   EventEmitter or on a new EventEmitter instance.
2. The number of arguments expected by a listener function should match the
   number of arguments passed to the `asyncemit` method excluding the event
   name.

See the following example:

```js
var EventEmitter = require('eventemitter3')
  , asyncemit = require('asyncemit');

var ee = new EventEmitter();
ee.asyncemit = asyncemit;

//
// The next `foo` listeners will not be executed until `next` is called.
//
ee.on('foo', function (arg, next) {
  // Do things with arg?
  next();
});

//
// Still executed, but synchronously.
//
ee.on('foo', function (arg) {

});

ee.asyncemit('foo', 'bar', function (err) {
  //
  // The error argument will be set if one of the async listeners called the
  // `next` callback with an `error` argument.
  //
});
```

## License

[MIT](LICENSE)

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