nanoevents
Advanced tools
Comparing version 5.1.10 to 5.1.11
# Change Log | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
## 5.1.11 | ||
* Fixed unsubscribing on cleaned `Emitter#events` (by Mikhail Nasyrov). | ||
## 5.1.10 | ||
@@ -5,0 +8,0 @@ * Fixed `package.types` path. |
let createNanoEvents = () => ({ | ||
events: {}, | ||
emit (event, ...args) { | ||
for (let i of this.events[event] || []) { | ||
i(...args) | ||
} | ||
;(this.events[event] || []).forEach(i => i(...args)) | ||
}, | ||
on (event, cb) { | ||
;(this.events[event] = this.events[event] || []).push(cb) | ||
return () => (this.events[event] = this.events[event].filter(i => i !== cb)) | ||
return () => | ||
(this.events[event] = (this.events[event] || []).filter(i => i !== cb)) | ||
} | ||
@@ -12,0 +11,0 @@ }) |
{ | ||
"name": "nanoevents", | ||
"version": "5.1.10", | ||
"version": "5.1.11", | ||
"description": "Simple and tiny (72 bytes) event emitter library", | ||
@@ -24,2 +24,3 @@ "keywords": [ | ||
"types": "./index.d.ts", | ||
"simple-pre-commit": "npx lint-staged", | ||
"type": "module", | ||
@@ -26,0 +27,0 @@ "main": "index.cjs", |
Sorry, the diff of this file is not supported yet
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
10798
99