Socket
Socket
Sign inDemoInstall

nanoevents

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nanoevents - npm Package Compare versions

Comparing version 5.1.8 to 5.1.9

3

CHANGELOG.md
# Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
## 5.1.9
* Add `package.types`.
## 5.1.8

@@ -5,0 +8,0 @@ * Fix ES module support.

11

package.json
{
"name": "nanoevents",
"version": "5.1.8",
"version": "5.1.9",
"description": "Simple and tiny (72 bytes) event emitter library",

@@ -23,2 +23,3 @@ "keywords": [

"sideEffects": false,
"types": "index.d.ts",
"type": "module",

@@ -29,8 +30,10 @@ "main": "index.cjs",

"exports": {
"./package.json": "./package.json",
".": {
"require": "./index.cjs",
"import": "./index.js"
}
"import": "./index.js",
"types": "index.d.ts"
},
"./package.json": "./package.json",
"index.d.ts": "index.d.ts"
}
}

@@ -41,2 +41,3 @@ # Nano Events

* [Install](#install)
* [TypeScript](#typescript)

@@ -52,2 +53,9 @@ * [Mixing to Object](#mixing-to-object)

## Install
```sh
npm install nanoevents
```
## TypeScript

@@ -102,3 +110,25 @@

With Typescript:
```ts
import { createNanoEvents, Emitter } from "nanoevents"
interface Events {
start: (startedAt: number) => void
}
class Ticker {
emitter: Emitter
constructor () {
this.emitter = createNanoEvents<Events>()
}
on<E extends keyof Events>(event: E, callback: Events[E]) {
return this.emitter.on(event, callback)
}
}
```
## Add Listener

@@ -105,0 +135,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc