nanoevents
Advanced tools
Comparing version 6.0.2 to 7.0.0
export let createNanoEvents = () => ({ | ||
events: {}, | ||
emit(event, ...args) { | ||
;(this.events[event] || []).forEach(i => i(...args)) | ||
for (let i = 0, handlers = this.events[event] || [], length = handlers.length; i < length; i++) handlers[i](...args) | ||
}, | ||
on(event, cb) { | ||
;(this.events[event] = this.events[event] || []).push(cb) | ||
return () => | ||
(this.events[event] = (this.events[event] || []).filter(i => i !== cb)) | ||
this.events[event]?.push(cb) || (this.events[event] = [cb]) | ||
return () => (this.events[event] = this.events[event]?.filter(i => cb !== i)) | ||
} | ||
}) |
{ | ||
"name": "nanoevents", | ||
"version": "6.0.2", | ||
"description": "Simple and tiny (72 bytes) event emitter library", | ||
"version": "7.0.0", | ||
"description": "Simple and tiny (99 bytes) event emitter library", | ||
"keywords": [ | ||
@@ -20,3 +20,3 @@ "EventEmitter", | ||
"engines": { | ||
"node": "^12.0.0 || ^14.0.0 || >=16.0.0" | ||
"node": "^14.0.0 || ^16.0.0 || >=18.0.0" | ||
}, | ||
@@ -23,0 +23,0 @@ "sideEffects": false, |
@@ -5,3 +5,3 @@ # Nano Events | ||
* Only **97 bytes** (minified and gzipped). | ||
* Only **99 bytes** (minified and gzipped). | ||
It uses [Size Limit] to control size. | ||
@@ -8,0 +8,0 @@ * `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
4735
85