# eventex

> An slower but more feature rich dropin replace for events.EventEmitter

Latest version **0.1.0** (published 2015-11-03) · BSD-2-Clause license · 0 weekly downloads

## Install

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

## 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.1.0 |
| Published | 2015-11-03 |
| First published | 2014-04-15 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | NStal |
| Maintainers | nstal |
| Keywords | EventEmitter |

## Links

- npm: https://www.npmjs.com/package/eventex
- npm.io page: https://npm.io/package/eventex

## 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.1.0 (latest) — 2015-11-03
- 0.0.5 — 2015-01-06
- 0.0.4 — 2015-01-06
- 0.0.3 — 2015-01-06
- 0.0.1 — 2014-04-20
- 0.0.0 — 2014-04-15

## README

# EventEx
An slower but more powerfull EventEmitter implementation. events.EventEmitter are more likely designed for low level system and sometimes hard to use. This module add some more friendly API.
# Usage
```coffee-script
EventEmitter = require("eventex").EventEmitter
class Parent
    constructor:()->
        @name = "myobj"
    addChild:(child)->
        # we need to maintain the listener so we can remove it later
        child._printChild = this.printChild.bind(this);
        child.on "update",child._printChild
    addChildEx:(child)->
        # no need to maintain listener
        child.listenBy this,"update",printChild
    removeChild:(child)->
        # remove with maintained listener
        child.removeListener "update",child._printChild
    removeChildEx:(child)->
        # remove any listener listen by `this`
        # easy work!
        child.stopListenBy this
    printChild:(child)->
        console.log @name,"child updates:",child.name
    showChilds:()-> 
        console.log(@name);
    
class Child extends EventEmitter
    @id = 0
    constructor:()->
        @name = "child #{Child.id++}"
    update:()->
        @emit "update",this
// old style

```


# API

* compatible with events.EventEmitter except without domain support and force error throw.
* eventex.EventEmitter.mixin(obj): mixin to an object.
* instance eventex.EventEmitter.listenBy(who,events,callback) callback will be called with ```who``` as the this parameter.
* instance eventex.EventEmitter.stopListenBy(who)
* instance eventex.EventEmitter.bubble(childEventEmitter,event,processor) bubble event using processor. processor should return array like ["newEventName",param1,param2...]. if no processor provided, the event will just bubbled as it is.
* instance eventex.EventEmitter.stopBubble(childEventEmitter,<event>)
* instance eventex.EventEmitter.stopAllBubble()
* instance eventex.EventEmitter.destroy() remove all listener on the event emitter, and all bubbles.

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