nanoevents
Advanced tools
Comparing version 1.0.0 to 1.0.1
# Change Log | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
## 1.0.1 | ||
* Reduce size (by Anton Khlynovskiy). | ||
## 1.0 | ||
@@ -5,0 +8,0 @@ * Remove `NanoEvents#once` method. |
16
index.js
@@ -54,12 +54,10 @@ /** | ||
var events = this.events | ||
// event variable is reused and repurposed, now it's an array of handlers | ||
event = this.events[event] = this.events[event] || [] | ||
event.push(cb) | ||
if (events[event]) { | ||
events[event].push(cb) | ||
} else { | ||
events[event] = [cb] | ||
} | ||
return function () { | ||
events[event].splice(events[event].indexOf(cb) >>> 0, 1) | ||
// a.splice(i >>> 0, 1) === if (i !== -1) a.splice(i, 1) | ||
// -1 >>> 0 === 0xFFFFFFFF, max possible array length | ||
event.splice(event.indexOf(cb) >>> 0, 1) | ||
} | ||
@@ -85,3 +83,3 @@ }, | ||
list.slice().map(function (i) { | ||
i.apply(this, args) | ||
i.apply(this, args) // this === global or window | ||
}) | ||
@@ -88,0 +86,0 @@ } |
{ | ||
"name": "nanoevents", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Simple and tiny (130 bytes) event emitter library", | ||
@@ -22,3 +22,3 @@ "keywords": [ | ||
"docdash": "^0.4.0", | ||
"eslint": "^4.7.0", | ||
"eslint": "^4.7.1", | ||
"eslint-config-logux": "^16.2.0", | ||
@@ -38,3 +38,3 @@ "eslint-config-standard": "^10.2.1", | ||
"rimraf": "^2.6.2", | ||
"size-limit": "^0.11.3", | ||
"size-limit": "^0.11.4", | ||
"yaspeller-ci": "^0.7.0" | ||
@@ -69,3 +69,3 @@ }, | ||
"path": "index.js", | ||
"limit": "130 B" | ||
"limit": "124 B" | ||
} | ||
@@ -72,0 +72,0 @@ ], |
@@ -6,3 +6,3 @@ # Nano Events | ||
* No Node.js [EventEmitter] compatibility. | ||
* Only 130 bytes (minified and gzipped). It uses [Size Limit] to control size. | ||
* Only 124 bytes (minified and gzipped). It uses [Size Limit] to control size. | ||
* `on` method returns `unbind` function. You don’t need to save | ||
@@ -9,0 +9,0 @@ callback to variable for `removeListener`. |
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
8182
93