# ee-event-emitter

> A portable event emitter class

Latest version **1.0.1** (published 2017-04-20) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install ee-event-emitter
pnpm add ee-event-emitter
yarn add ee-event-emitter
bun add ee-event-emitter
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-04-20 |
| First published | 2013-08-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=v7.7 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Michael van der Weg |
| Maintainers | ee |
| Keywords | event, eventemitter |

## Links

- npm: https://www.npmjs.com/package/ee-event-emitter
- Repository: https://github.com/eventEmitter/ee-event-emitter
- Issues: https://github.com/eventEmitter/ee-event-emitter/issues
- npm.io page: https://npm.io/package/ee-event-emitter

## 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

- 1.0.1 (latest) — 2017-04-20
- 1.0.0 — 2017-04-12
- 0.3.1 — 2015-07-16
- 0.3.0 — 2015-07-10
- 0.2.2 — 2015-07-10
- 0.2.1 — 2015-05-28
- 0.2.0 — 2014-08-24
- 0.1.3 — 2014-05-06
- 0.1.2 — 2014-05-06
- 0.1.1 — 2014-05-06
- 0.1.0 — 2013-08-21

## README

# ee-event-emitter


A portable event emitter class

## API

	var EventEmitter = require('ee-event-emitter');
	var eventEmitter = new EventEmitter();

	// attach listener
	eventEmitter.on('eventName', cb);

	// attach listsner which is called once
	eventEmitter.once('eventName', cb);

	// remove all listeners for all events
	eventEmitter.off();

	// remove listeners for specific event
	eventEmitter.off('eventName');

	// remove a single listener
	eventEmitter.off('eventName', listener);

	// emit an event
	eventEmitter.emit('eventName', arg, arg, ....);

	// get all listeners
	eventEmitter.listener();

	// get lsisteners for a specific event
	eventEmitter.listsner('eventName');

	// event which is emitted when an event listener is added
	eventEmitter.on('listener', function(eventName, listener){});

	// event which is emitted when an event listener is removed
	eventEmitter.on('removeListener', function(eventName, listener ){});


## Examples


	var   Class     		= require('ee-class')
    	, EventEmitter    	= require('ee-event-emitter');


	var Human = new Class({
	      ssinherits: EventEmitter
	    , name: ''
	    , age: 29

	    , init: function(options) {
	        this.name = options.name;
	    }


	    , sayHello: function(to) {
	        this.emit('startHello');
	        console.log('Hi %s, my name is %s, i'm %s years old.', to, this.name, this.age);
	        this.emit('endHello');
	    }
	});



	var Boy = new Class({
	      inherits: Human
	    , age: 12
	});


	var dylan = new Boy({
	    name: 'Dylan'
	});


	dylan.on('startHello', function() {
		console.log('starting console output:');
	});


	dylan.on('endHello', function() {
		console.log('finished console output:');
	});


	dylan.sayHello('michael');  // starting console output:
	                            // Hi my name is Dylan and i'm 12 years old.
	                      		// finished console output!

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