# tower-emitter

> Event emitter

Latest version **0.1.01** (published 2013-06-24) · 0 weekly downloads

## Install

```sh
npm install tower-emitter
pnpm add tower-emitter
yarn add tower-emitter
bun add tower-emitter
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.01 |
| Published | 2013-06-24 |
| First published | 2013-04-22 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | viatropos |

## Links

- npm: https://www.npmjs.com/package/tower-emitter
- Repository: http://github.com/tower/emitter
- npm.io page: https://npm.io/package/tower-emitter

## Dependencies (1)

- [indexof](https://npm.io/package/indexof.md) *

## Recent versions

- 0.1.01 (latest) — 2013-06-24
- 0.1.0pre — 2013-06-02
- 0.1.0 — 2013-04-22

## README

# Tower Emitter

Event emitter component (started from component/emitter).

## Installation

node.js:

```bash
$ npm install tower-emitter
```

browser:

```bash
$ component install tower/emitter
```

## API

### Emitter(obj)

  The `Emitter` may also be used as a mixin. For example
  a "plain" object may become an emitter, or you may
  extend an existing prototype.

  As an `Emitter` instance:

```js
var Emitter = require('emitter');
var emitter = new Emitter;
emitter.emit('something');
```

  As a mixin:

```js
var Emitter = require('emitter');
var user = { name: 'tobi' };
Emitter(user);

user.emit('im a user');
```

  As a prototype mixin:

```js
var Emitter = require('emitter');
Emitter(User.prototype);
```
  
### Emitter#on(event, fn)

  Register an `event` handler `fn`.

### Emitter#once(event, fn)

  Register a single-shot `event` handler `fn`,
  removed immediately after it is invoked the
  first time.

### Emitter#off(event, fn)

  Remove `event` handler `fn`, or pass only the `event`
  name to remove all handlers for `event`.

### Emitter#emit(event, ...)

  Emit an `event` with variable option args.

### Emitter#listeners(event)

  Return an array of callbacks, or an empty array.

### Emitter#hasListeners(event)

  Check if this emitter has `event` handlers.

## Notes

- https://github.com/component/clone/blob/master/index.js

## Testing

Install testem:

```bash
$ npm install -g testem
```

Run tests:

```bash
$ testem
```

Then, open all the browsers you want to test by going to the outputted url defaulted to [http://localhost:7357](http://localhost:7357)

Tests will run on any open browser linked to the stated url and your current Node environment.

## Contributing

Before you send a pull request, make sure your code meets the style guidelines at [https://github.com/tower/style-guide](https://github.com/tower/style-guide) and all tests pass.

## License

MIT

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