🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

tsee

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsee - npm Package Compare versions

Comparing version

to
1.3.4

2

package.json
{
"name": "tsee",
"version": "1.3.3",
"version": "1.3.4",
"description": "Typed EventEmitter implemented with typed args",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -8,2 +8,4 @@ [![NPM Version](https://badge.fury.io/js/tsee.svg?style=flat)](https://www.npmjs.com/package/tsee) [![NPM Downloads](https://img.shields.io/npm/dw/tsee)](https://www.npmjs.com/package/tsee)

[Check 'tseep'! Same api but world fastest event emitter](https://github.com/Morglod/tseep)
## Install & use

@@ -16,23 +18,25 @@

Simple usage:
```ts
import { EventEmitter } from 'tsee';
import { EventEmitter } from "tsee";
const events = new EventEmitter<{
foo: (a: number, b: string) => void,
foo: (a: number, b: string) => void;
}>();
// foo's arguments is fully type checked
events.emit('foo', 123, 'hello world');
events.emit("foo", 123, "hello world");
```
Cast any other compatible to `NodeJS.EventEmitter` to typed:
```ts
import { asTypedEventEmitter } from 'tsee';
import { asTypedEventEmitter } from "tsee";
const typedEmitter = asTypedEventEmitter<{
foo: (a: number, b: string) => void,
boo: (a: number, b: string) => void,
foo: (a: number, b: string) => void;
boo: (a: number, b: string) => void;
}>(myEmitter);
typedEmitter.emit('foo', 123, 'hello world');
typedEmitter.emit("foo", 123, "hello world");
```

@@ -39,0 +43,0 @@