Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nanoevents

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nanoevents - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

3

CHANGELOG.md
# Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
## 1.0.3
* Reduce npm package size.
## 1.0.2

@@ -5,0 +8,0 @@ * Reduce size (by Anton Khlynovskiy).

3

index.js

@@ -39,2 +39,3 @@ (

* Add a listener for a given event.
*
* @param {string} event The event name.

@@ -79,3 +80,3 @@ * @param {function} cb The listener function.

*
* @returns {undefined}
* @return {undefined}
*

@@ -82,0 +83,0 @@ * @example

{
"name": "nanoevents",
"version": "1.0.2",
"description": "Simple and tiny (119 bytes) event emitter library",
"version": "1.0.3",
"description": "Simple and tiny (117 bytes) event emitter library",
"keywords": [

@@ -22,19 +22,20 @@ "EventEmitter",

"docdash": "^0.4.0",
"eslint": "^4.7.1",
"eslint-config-logux": "^16.2.0",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-es5": "^1.1.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jest": "^21.1.0",
"eslint-plugin-node": "^5.1.1",
"eslint-plugin-promise": "^3.5.0",
"eslint": "^4.19.1",
"eslint-ci": "^0.1.1",
"eslint-config-logux": "^23.0.0",
"eslint-config-standard": "^11.0.0",
"eslint-plugin-es5": "^1.3.1",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-jest": "^21.17.0",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-promise": "^3.8.0",
"eslint-plugin-security": "^1.4.0",
"eslint-plugin-standard": "^3.0.1",
"jest": "^21.1.0",
"eslint-plugin-standard": "^3.1.0",
"jest": "^23.1.0",
"jsdoc": "^3.5.5",
"lint-staged": "^4.2.1",
"lint-staged": "^7.1.3",
"pre-commit": "^1.2.2",
"rimraf": "^2.6.2",
"size-limit": "^0.11.4",
"yaspeller-ci": "^0.7.0"
"size-limit": "^0.18.2",
"yaspeller-ci": "^1.0.0"
},

@@ -45,3 +46,3 @@ "scripts": {

"clean": "rimraf docs/ coverage/",
"lint": "eslint *.js test/*.js",
"lint": "eslint-ci *.js test/*.js",
"docs": "jsdoc --configure .jsdocrc *.js",

@@ -51,2 +52,3 @@ "test": "jest --coverage && yarn lint && size-limit && yarn spellcheck"

"jest": {
"testEnvironment": "node",
"coverageThreshold": {

@@ -61,18 +63,2 @@ "global": {

},
"eslintConfig": {
"extends": "eslint-config-logux/browser",
"rules": {
"no-invalid-this": "off"
}
},
"size-limit": [
{
"path": "index.js",
"limit": "119 B"
}
],
"lint-staged": {
"*.md": "yaspeller-ci",
"*.js": "eslint"
},
"pre-commit": [

@@ -79,0 +65,0 @@ "lint-staged"

@@ -6,3 +6,3 @@ # Nano Events

* No Node.js [EventEmitter] compatibility.
* Only 119 bytes (minified and gzipped). It uses [Size Limit] to control size.
* Only 117 bytes (minified and gzipped). It uses [Size Limit] to control size.
* `on` method returns `unbind` function. You don’t need to save

@@ -120,2 +120,23 @@ callback to variable for `removeListener`.

#### Once
If you need add event listener only for first event dispatch,
you can use this snippet:
```js
class Ticker {
constructor() {
this.emitter = new NanoEvents()
}
once (event, callback) {
const unbind = this.emitter.on(event, function () {
unbind()
callback.apply(this, arguments)
})
return unbind
}
}
```
#### Remove all listeners

@@ -122,0 +143,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc