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

@nodeart/event_emitter

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nodeart/event_emitter - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

0

index.js

@@ -0,0 +0,0 @@ /**

3

package.json
{
"name": "@nodeart/event_emitter",
"version": "1.2.0",
"version": "1.2.1",
"description": "Simple EventEmitter pattern",

@@ -19,3 +19,2 @@ "main": "./index.js",

],
"devDependencies": {},
"engines": {

@@ -22,0 +21,0 @@ "node": ">=6.0.0"

@@ -9,16 +9,27 @@ [![bitHound Overall Score](https://www.bithound.io/github/NodeArt/EventEmitter/badges/score.svg)](https://www.bithound.io/github/NodeArt/EventEmitter)

const events = new EventEmitter();
events.on('eventName', ...fns);
events.once('eventName', ...fns);
events.off('eventName', ...fns);
events.offAll();
events.emit('eventName', {
ctx: true
}, ...args);
events.on('eventName', ...fns)
.once('eventName', ...fns)
.off('eventName', ...fns)
.emit('eventName', {
ctx: true
}, ...args)
.times('eventName2', 3, ...fns)
.offAll();
const inherited = {};
// reset prototype
EventEmitter
.inherit(inherited)
.on('smth', ...fns);
const extended = {};
// add EventEmitter functionality as mixin
EventEmitter
.extend(extended)
.on('smth', ...fns);
// One can remove some functions from listeners array by passing them to .off method,
// but to remove particular event use .off with eventName only;
// but to remove all listeners event use .off with eventName only;
```
Features:
1) any number of functions can be put as listeners
2) chaining available
3) can be used in node.js and in browser

@@ -0,0 +0,0 @@ /**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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