Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nanoevents

Package Overview
Dependencies
Maintainers
1
Versions
44
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 7.0.1 to 8.0.0

34

index.d.ts

@@ -13,4 +13,20 @@ interface EventsMap {

export declare class Emitter<Events extends EventsMap = DefaultEvents> {
export interface Emitter<Events extends EventsMap = DefaultEvents> {
/**
* Calls each of the listeners registered for a given event.
*
* ```js
* ee.emit('tick', tickType, tickDuration)
* ```
*
* @param event The event name.
* @param args The arguments for listeners.
*/
emit<K extends keyof Events>(
this: this,
event: K,
...args: Parameters<Events[K]>
): void
/**
* Event names in keys and arrays with listeners in values.

@@ -43,18 +59,2 @@ *

on<K extends keyof Events>(this: this, event: K, cb: Events[K]): Unsubscribe
/**
* Calls each of the listeners registered for a given event.
*
* ```js
* ee.emit('tick', tickType, tickDuration)
* ```
*
* @param event The event name.
* @param args The arguments for listeners.
*/
emit<K extends keyof Events>(
this: this,
event: K,
...args: Parameters<Events[K]>
): void
}

@@ -61,0 +61,0 @@

export let createNanoEvents = () => ({
events: {},
emit(event, ...args) {

@@ -9,2 +8,3 @@ let callbacks = this.events[event] || []

},
events: {},
on(event, cb) {

@@ -11,0 +11,0 @@ this.events[event]?.push(cb) || (this.events[event] = [cb])

{
"name": "nanoevents",
"version": "7.0.1",
"description": "Simple and tiny (99 bytes) event emitter library",
"version": "8.0.0",
"description": "Simple and tiny (130 bytes) event emitter library",
"keywords": [

@@ -20,3 +20,3 @@ "EventEmitter",

"engines": {
"node": "^14.0.0 || ^16.0.0 || >=18.0.0"
"node": "^16.0.0 || ^18.0.0 || >=20.0.0"
},

@@ -23,0 +23,0 @@ "sideEffects": false,

@@ -5,5 +5,5 @@ # Nano Events

* Only **99 bytes** (minified and gzipped).
* Only **130 bytes** (minified and gzipped).
It uses [Size Limit] to control size.
* `on` method returns `unbind` function. You don’t need to save
* The `on` method returns `unbind` function. You don’t need to save
callback to variable for `removeListener`.

@@ -41,2 +41,2 @@ * TypeScript and ES modules support.

## Docs
Read **[full docs](https://github.com/ai/nanoevents#readme)** on GitHub.
Read full docs **[here](https://github.com/ai/nanoevents#readme)**.
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