nanoevents
Advanced tools
Comparing version 0.2.0 to 0.3.0
# Change Log | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
## 0.3 | ||
* Allow to change listeners during the emit. | ||
## 0.2 | ||
@@ -5,0 +8,0 @@ * Throw a error on non-function listener. |
18
index.js
@@ -26,2 +26,5 @@ /** | ||
* @type {object} | ||
* | ||
* @example | ||
* Object.keys(ee.events) | ||
*/ | ||
@@ -66,3 +69,3 @@ this.events = { } | ||
* | ||
* @return {function} Unbind listener from event | ||
* @return {function} Unbind listener from event. | ||
* | ||
@@ -88,3 +91,3 @@ * @example | ||
* | ||
* @return {function} Unbind listener from event | ||
* @return {function} Unbind listener from event. | ||
* | ||
@@ -117,3 +120,4 @@ * @example | ||
var rm = [] | ||
var copy = list.slice(0) | ||
var args = new Array(arguments.length - 1) | ||
@@ -124,10 +128,8 @@ for (var i = 1; i < arguments.length; i++) { | ||
for (i = 0; i < list.length; i++) { | ||
var l = list[i] | ||
if (l.once) rm.push(l) | ||
for (i = 0; i < copy.length; i++) { | ||
var l = copy[i] | ||
l.fn.apply(this, args) | ||
if (l.once) l.rm() | ||
} | ||
for (i = 0; i < rm.length; i++) rm[i].rm() | ||
return true | ||
@@ -134,0 +136,0 @@ } |
{ | ||
"name": "nanoevents", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Small and simple events API", | ||
@@ -20,23 +20,28 @@ "keywords": [ | ||
"repository": "ai/nanoevents", | ||
"dependencies": {}, | ||
"dependencies": { }, | ||
"devDependencies": { | ||
"docdash": "^0.4.0", | ||
"eslint": "^3.5.0", | ||
"eslint-config-standard": "^6.0.1", | ||
"eslint-plugin-promise": "^2.0.1", | ||
"eslint-plugin-standard": "^2.0.0", | ||
"jest": "^15.1.1", | ||
"jsdoc": "^3.4.1", | ||
"lint-staged": "^3.0.2", | ||
"eslint": "^3.10.2", | ||
"eslint-config-standard": "^6.2.1", | ||
"eslint-plugin-promise": "^3.4.0", | ||
"eslint-plugin-standard": "^2.0.1", | ||
"jest": "^17.0.3", | ||
"jsdoc": "^3.4.3", | ||
"lint-staged": "^3.2.1", | ||
"pre-commit": "^1.1.3", | ||
"rimraf": "^2.5.4", | ||
"yaspeller": "^2.9.1" | ||
"uglifyjs": "^2.4.10", | ||
"yaspeller": "^3.0.0" | ||
}, | ||
"scripts": { | ||
"lint-staged": "lint-staged", | ||
"spellcheck": "npm run docs && yaspeller *.md docs/*.html", | ||
"clean": "rimraf docs/ coverage/", | ||
"spellcheck": "npm run cleandocs && yaspeller *.md docs/*.html", | ||
"cleandocs": "npm run docs && rimraf docs/*.js.html", | ||
"clean": "rimraf docs/ coverage/ *.gz", | ||
"lint": "eslint *.js test/*.js", | ||
"docs": "jsdoc --configure .jsdocrc *.js", | ||
"test": "jest --coverage && npm run lint && npm run spellcheck" | ||
"test": "jest --coverage && npm run lint && npm run spellcheck", | ||
"compress": "uglifyjs index.js -o min.js && gzip -9 -f min.js", | ||
"show": "ls -lh *.gz | awk '{print \"Size:\", $5\"B\"}'", | ||
"size": "npm run compress && npm run show && rm *.gz" | ||
}, | ||
@@ -54,3 +59,6 @@ "jest": { | ||
"valid-jsdoc": "error", | ||
"no-new": "off" | ||
"max-len": [ | ||
2, | ||
80 | ||
] | ||
}, | ||
@@ -57,0 +65,0 @@ "env": { |
@@ -6,3 +6,3 @@ # Nano Events | ||
* No node.js [EventEmitter] compatibility. | ||
* Only 921 bytes after Uglify. | ||
* Only 447 bytes (minified and gzipped). | ||
* `on` and `once` methods return `unbind` function. You don’t need to save | ||
@@ -17,3 +17,3 @@ callback to variable for `removeListener`. | ||
const unbind = emitter.on('tick', volume => { | ||
summery += volume | ||
summary += volume | ||
}) | ||
@@ -29,2 +29,7 @@ emitter.once('tick', () => { | ||
<a href="https://evilmartians.com/?utm_source=nanoevents"> | ||
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" | ||
alt="Sponsored by Evil Martians" width="236" height="54"> | ||
</a> | ||
## Usage | ||
@@ -31,0 +36,0 @@ |
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
8084
120
119
12