# sse-listener

> A simple SSE listener that plan to become more generic in future updates

Latest version **1.0.49** (published 2020-10-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install sse-listener
pnpm add sse-listener
yarn add sse-listener
bun add sse-listener
```

## 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.49 |
| Published | 2020-10-18 |
| First published | 2020-10-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 158 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Syntax |
| Maintainers | syntaxar |
| Keywords | angular, typescript, component, sse, listener |

## Links

- npm: https://www.npmjs.com/package/sse-listener
- Repository: https://github.com/USSDlover/sse-listener
- Issues: https://github.com/USSDlover/sse-listener/issues
- npm.io page: https://npm.io/package/sse-listener

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.0.0

## 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

- 1.0.49 (latest) — 2020-10-18
- 1.0.47 — 2020-10-17
- 1.0.39 — 2020-10-17
- 1.0.37 — 2020-10-17

## README

# SseListener

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.1.5.

This library is plan to become generic in future updates, but for now it's generated to work with specific environment.

Demo is available here [Demo SSE Listener](https://angular-ivy-k2w7nr.stackblitz.io/)

[Demo source code](https://github.com/USSDlover/angular-demo-sse-listener)

[SSE Listener source code](https://github.com/USSDlover/sse-listener)

[NPM](https://www.npmjs.com/package/sse-listener)

## Installation

To install you will need at least node v10.

`npm install --save sse-listener`  

## Usage

Using component is easy as just following these steps

##### After installation

After installation `SseListenerModule` will be available to import into any module
that meant to use the component.
```typescript
@Module({
    imports: [SseListenerModule]
})
```

> Component will be access able with it's selector `<sse-listener></sse-listener>`
```angular2html
<sse-listener
    (sseEvent)="onNewEvent($event)"
    [iata]="{dest: 'DESTINATION IATA', origin: 'ORIGIN IATA'}"
    [baseUrl]="'https://path/to/server/sent/event'">
  </sse-listener>
```

- sseEvent
    > Will emit when ever  new event received from server

- iata
    > Will set destination and origin for airports that will be used to set argument on our test server side application

- baseUrl
    > Will init the base saver base on actions that application will try to do before subscribing to server events

###### Types

```typescript
@Input() iata: {dest: string; origin: string};
@Input() baseUrl: string;

@Output() sseEvent: EventEmitter<IEventSse> = new EventEmitter<IEventSse>();
```

###### IEventSse
Just type definition for Typescript, to use `data` property;

```typescript
interface IEventSse extends Event {
  data: string;
}
```

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