# andshil-ts-notifications

> Typescript realization concept of events

Latest version **0.1.4** (published 2020-08-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install andshil-ts-notifications
pnpm add andshil-ts-notifications
yarn add andshil-ts-notifications
bun add andshil-ts-notifications
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2020-08-27 |
| First published | 2020-08-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Andrew Shilkin |
| Maintainers | andrewshilkin |
| Keywords | typescript, events |

## Links

- npm: https://www.npmjs.com/package/andshil-ts-notifications
- Repository: https://github.com/andrewshilkin/ts-notifications
- Homepage: https://github.com/andrewshilkin/ts-notifications#readme
- Issues: https://github.com/andrewshilkin/ts-notifications/issues
- npm.io page: https://npm.io/package/andshil-ts-notifications

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.1.4 (latest) — 2020-08-27
- 0.1.3 — 2020-08-27
- 0.1.2 — 2020-08-27
- 0.1.1 — 2020-08-27
- 0.1.0 — 2020-08-07

## README

# andshil-ts-notifications
Typescript realization concept of events

sample: 
```typescript
class NotificationMap extends Notify.NotificationMap { // concreat NotificationMap class

}

class Recipient implements Notify.IRecipient {
    shouldReceiveNotifications: boolean = true;
    notificationMap: Notify.NotificationMap;

    constructor(notificationMap: Notify.NotificationMap) {
        this.notificationMap = notificationMap;
    }
    handleNotification(notification: Notify.Notification): void {
        console.log(`incomming ${notification.name}`);
    }
    getInterests(): string[] {
        return [
            "TEST_EVENT",
        ]
    }
    sendNotification(type: string, body?: any): void {
        this.notificationMap.notify(new Notify.Notification(type, body));
    }
    
}

const notificationMap: NotificationMap = new NotificationMap(); // create notification map
const recipient: IRecipient = new Recipient(notificationMap); // create recipient
notificationMap.register(recipient); // register recipient
recipient.sendNotification("TEST_EVENT"); // send notification to map, that we will get as interest event at recipients
recipient.sendNotification("NOT_INTEREST_EVENT"); // send event with not listen for test
```

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