nanoevents
Advanced tools
Comparing version 8.0.0 to 9.0.0
11
index.js
export let createNanoEvents = () => ({ | ||
emit(event, ...args) { | ||
let callbacks = this.events[event] || [] | ||
for (let i = 0, length = callbacks.length; i < length; i++) { | ||
for ( | ||
let i = 0, | ||
callbacks = this.events[event] || [], | ||
length = callbacks.length; | ||
i < length; | ||
i++ | ||
) { | ||
callbacks[i](...args) | ||
@@ -10,3 +15,3 @@ } | ||
on(event, cb) { | ||
this.events[event]?.push(cb) || (this.events[event] = [cb]) | ||
;(this.events[event] ||= []).push(cb) | ||
return () => { | ||
@@ -13,0 +18,0 @@ this.events[event] = this.events[event]?.filter(i => cb !== i) |
{ | ||
"name": "nanoevents", | ||
"version": "8.0.0", | ||
"description": "Simple and tiny (130 bytes) event emitter library", | ||
"version": "9.0.0", | ||
"description": "Simple and tiny (107 bytes) event emitter library", | ||
"keywords": [ | ||
@@ -20,3 +20,3 @@ "EventEmitter", | ||
"engines": { | ||
"node": "^16.0.0 || ^18.0.0 || >=20.0.0" | ||
"node": "^18.0.0 || >=20.0.0" | ||
}, | ||
@@ -23,0 +23,0 @@ "sideEffects": false, |
@@ -5,3 +5,3 @@ # Nano Events | ||
* Only **130 bytes** (minified and gzipped). | ||
* Only **107 bytes** (minified and brotlied). | ||
It uses [Size Limit] to control size. | ||
@@ -8,0 +8,0 @@ * The `on` method returns `unbind` function. You don’t need to save |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4769
95