# global-event-service-new

> A global event handler service.

Latest version **1.0.1** (published 2021-05-02) · 0 weekly downloads

## Install

```sh
npm install global-event-service-new
pnpm add global-event-service-new
yarn add global-event-service-new
bun add global-event-service-new
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-05-02 |
| First published | 2021-05-02 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 45.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jorge Fernandez |
| Maintainers | jorgeferhn |
| Keywords | global, event, handler, service, angular |

## Links

- npm: https://www.npmjs.com/package/global-event-service-new
- npm.io page: https://npm.io/package/global-event-service-new

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) >=1.9.0

## 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.1 (latest) — 2021-05-02
- 1.0.0 — 2021-05-02

## README

# A Glober event handler for angular

This is a global event emitter for your Angular applicaion.
If you want to trigger changes in mutiple components/ places with change in one component/ place.
You can publish or emit an event( data change) with a name/ id on which you want to perform some action and then catch that event with name/ id in other components/ modules.

> Use Case: With update in profile picture/ username the header components picture/ name must be updated instantly.

#### Steps to use
##### Install
run `npm install global-event-service --save`
Done :) Now you can use this with in your application.

##### Usage
###### Emitting/ Creating/ Generating an event from `component-A`
* Import in your component.
~~~
    import { GlobalEvent } from 'global-event-service';
~~~
* Inject dependency
~~~
    constructor( private global: GlobalEvent) { }
~~~
* Emitting Event
~~~
    this.global.notifyDataChanged('profile-pic-update', 'base64-profile-picture');
~~~
###### Catching the event on `component-B`
* Import in your component.
~~~
    import { GlobalEvent } from 'global-event-service';
~~~
* Inject dependency
~~~
    constructor( private global: GlobalEvent) { }
~~~
* Catching Event
~~~
    constructor( private global: GlobalEvent) {
        this.global.subscribe('profile-pic-update', (pic) => 
        console.log('Profile pic updated', pic);
    )
  }
~~~

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