# signalr-event-emitter

> A nicer way to receive SignalR events

Latest version **1.0.5** (published 2022-07-23) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install signalr-event-emitter
pnpm add signalr-event-emitter
yarn add signalr-event-emitter
bun add signalr-event-emitter
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2022-07-23 |
| First published | 2022-07-22 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 14.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Brian Simon |
| Maintainers | bsssshhhhhhh |
| Keywords | events, event emitter, signalr, typescript |

## Links

- npm: https://www.npmjs.com/package/signalr-event-emitter
- Repository: https://github.com/bsssshhhhhhh/signalr-event-emitter
- Homepage: https://github.com/bsssshhhhhhh/signalr-event-emitter#readme
- Issues: https://github.com/bsssshhhhhhh/signalr-event-emitter/issues
- npm.io page: https://npm.io/package/signalr-event-emitter

## Dependencies (1)

- [simple-typed-events](https://npm.io/package/simple-typed-events.md) ^1.1.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.5 (latest) — 2022-07-23
- 1.0.4 — 2022-07-23
- 1.0.3 — 2022-07-22
- 1.0.1 — 2022-07-22
- 1.0.0 — 2022-07-22

## README

# signalr-event-emitter

[![npm](https://img.shields.io/npm/v/signalr-event-emitter)](https://www.npmjs.com/package/signalr-event-emitter)

A utility function that allows for receiving method invocations from a SignalR hub in a type-safe way

## Why?

Because the SignalR client library leaves a lot to be desired in terms of nice typescript support.  The `createSignalrEventEmitter` function in this package allows for defining event names and parameters via TypeScript.


## Example

```ts

// build hub connection
const hubConnection = new signalR.HubConnectionBuilder()
  .withUrl('/somehub')
  .build();


// define method names and the parameters expected
interface Methods {
  started: () => void;
  progress: (processedCount: number, totalCount: number) => void;
  finished: () => void;
}

// attach emitter
const emitter = createSignalrEventEmitter<Methods>(hubConnection);


emitter.on('progress', (processedCount, totalCount) => {

});

```

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