# ngx-events

> This library adds an Event property decorator and an EventListener method decorator.

Latest version **0.1.1** (published 2018-01-21) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2018-01-21 |
| First published | 2018-01-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | chaosmonster |

## Links

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

## Recent versions

- 0.1.1 (latest) — 2018-01-21
- 0.1.0 — 2018-01-21

## README

# ngx-events

This library adds an Event property decorator and an EventListener method decorator.

You can add the `Event` property decorator to any angular EventEmitter and define it's name as a string.

```
@Event('someName') eventEmitter: EventEmitter<T> = new EventEmitter();
```

You can listen to this event by adding a method decorator called 
EventListener` with the event's name as parameter

```
 @EventListener('someName')
 someMethod(eventValue: T) {
   ...
 }
```

Whenever the annotated eventEmitter emits the annotated method will be called.

## Example

```
class AppComponent {

@Event('eventName') buttonClicked: EventEmitter<string> = new EventEmitter();

  clicked() {
    this.buttonClicked.emit('clicked me');
  }
}

class SomeServiceOrComponent {
 
 @EventListener('eventName')
 listenToEventName(eventValue: string) {
   console.log('somewhere in the app the eventName eventEmitter emitted the following value', event);
 }
}
```

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