# fn-emitter

> extend your function with an event emitter.

Latest version **2.0.6** (published 2018-02-15) · MIT license · 0 weekly downloads

## Install

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

## 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 | 2.0.6 |
| Published | 2018-02-15 |
| First published | 2017-01-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Gokul T |
| Maintainers | gokult |
| Keywords | events, emitter, emit, on |

## Links

- npm: https://www.npmjs.com/package/fn-emitter
- Repository: https://github.com/gokul-t/fn-emitter
- Homepage: https://github.com/gokul-t/fn-emitter#readme
- Issues: https://github.com/gokul-t/fn-emitter/issues
- npm.io page: https://npm.io/package/fn-emitter

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.0.6 (latest) — 2018-02-15
- 2.0.5 — 2017-01-08
- 2.0.4 — 2017-01-03
- 2.0.3 — 2017-01-03
- 2.0.2 — 2017-01-03
- 2.0.1 — 2017-01-02
- 2.0.0 — 2017-01-02
- 1.0.1 — 2017-01-02
- 1.0.0 — 2017-01-01

## README

fn-emitter
==========

Extend your function with an event emitter.


## Installation &nbsp; 

```sh
$ npm install fn-emitter
```

## Usage

var Emitter = require("fn-emitter");

var Demo = function(){
	new Emitter(this);
}

var demo = new Demo();
var cb = function(msg){
	console.log(msg);
};

**register an event listener**

demo.on("test",cb);

**emit an event**

demo.emit("test","successfully emitted and recieved");

**remove the event listener**

demo.off("test",cb)


## api

**on** : register an event listener
.on("event name",callback)

**emit** : emit an event.
.emit("event name",params...)

**off** : unregister an event listener or all listeners for an event
.off("event name",[cb])
.off("event name") - if 2nd parameter is not specified then all listeners for the specific event is unregistered.

demo at https://runkit.com/586a7335e32a6d00155783d4/586bf0754fcd4e0014699586

## License

MIT &copy; 2016 contributors

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