# angular2-http-event

> simple events center for angular2 http module

Latest version **1.0.0** (published 2017-06-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install angular2-http-event
pnpm add angular2-http-event
yarn add angular2-http-event
bun add angular2-http-event
```

## 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 | 1.0.0 |
| Published | 2017-06-05 |
| First published | 2017-06-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | guchengf@gmail.com |
| Maintainers | gucheen |
| Keywords | angular, angular2, http, event, rxjs |

## Links

- npm: https://www.npmjs.com/package/angular2-http-event
- Repository: https://github.com/gucheen/angular2-http-event
- Homepage: https://github.com/gucheen/angular2-http-event#readme
- Issues: https://github.com/gucheen/angular2-http-event/issues
- npm.io page: https://npm.io/package/angular2-http-event

## 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.0 (latest) — 2017-06-05

## README

# angular2-http-event
simple events center for angular2 http module

## Usage

### 1. add decorator `httpEmitter` to http method

```ts
import { httpEmitter } from '/path/to/http-event.service';

class demoHttpService() {
  constructor(private http: Http) {}
  
  @httpEmitter
  query(args) {
    return this.http.get().map(response => response.json());
  }
}
```

now this method will emit 'START' and 'FINISH' events.

### 2. subscribe to http event

``` ts
import { HttpEventService } from '/path/to/http-event.service';

@Component({...})
class DemoComponent implements OnInit {
  constructor(private httpEvent: HttpEventService) {}
  
  ngOnInit() {
    this.httpEvent.httpEventCenter.subscribe((type: HttpEventType) => {
      // event handler here...
    });
  }
}
```

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