# context-events

> Node's event emitter with optional context argument, like Backbone.

Latest version **0.0.2** (published 2014-12-26) · 0 weekly downloads

## Install

```sh
npm install context-events
pnpm add context-events
yarn add context-events
bun add context-events
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2014-12-26 |
| First published | 2014-12-21 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.4.x |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Oskar Dahlberg |
| Maintainers | oskardahlberg |
| Keywords | events, eventEmitter, eventDispatcher, listeners |

## Links

- npm: https://www.npmjs.com/package/context-events
- Repository: https://github.com/oskardahlberg/context-events
- Issues: http://github.com/oskardahlberg/context-events/issues/
- npm.io page: https://npm.io/package/context-events

## Dependencies (1)

- [events](https://npm.io/package/events.md) ^1.0.2

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

- 0.0.2 (latest) — 2014-12-26
- 0.0.1 — 2014-12-21

## README

# context-events

---
God bless arrow functions! The need for this is nil in a post-es2015 world
---


Node's event emitter with optional context argument, like Backbone.

Forked from https://github.com/Gozala/events

Use require('context-events/monkey') to get a patched version of the original Events.
Should be fully backwords compatible, only acts differently when given context argument.

## Install ##

```
npm install context-events
```

## Require ##

```javascript
var EventEmitter = require('context-events')
```

## Usage ##

See the [node.js event emitter docs](http://nodejs.org/api/events.html)

## Modified proto methods ##

All context arguments are optional

### addListener / on / once (type, listener, context)
Set the context the listener will be called from it.

The first argument in the callback will be the callee.
Example: 

	emitter.on('type', listener, context);
	emitter.emit('type', arg1, arg2);
	->
	listener.call(context, emitter, arg1, arg2)

### removeListener (type, listener, context)
Remove a listener added with a context

### removeAllListeners (type, context)
Remove listeners with a certain context, type null for all

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