Socket
Book a DemoInstallSign in
Socket

signalr-event-emitter

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

signalr-event-emitter

A nicer way to receive SignalR events

1.0.5
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

signalr-event-emitter

npm

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


// 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) => {

});

Keywords

events

FAQs

Package last updated on 23 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.