New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

forward-emitter

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

forward-emitter - npm Package Compare versions

Comparing version

to
0.1.1

17

index.js

@@ -9,16 +9,17 @@ 'use strict';

// Listeners bound to the destination emitter should be bound to the source emitter.
dest.on('newListener', newListener);
function __forward_emitter_newListener(eventName, listener) {
if (filterFn(eventName) && listener.name.indexOf('__forward_emitter_') !== 0) src.on(eventName, listener);
}
function newListener(eventName, listener) {
if (filterFn(eventName) && listener !== removeListener) src.on(eventName, listener);
function __forward_emitter_removeListener(eventName, listener) {
src.removeListener(eventName, listener);
}
// Listeners bound to the destination emitter should be bound to the source emitter.
dest.on('newListener', __forward_emitter_newListener);
// When a listener is removed from the destination emitter, remove it from the source emitter
// (otherwise it will continue to be called).
dest.on('removeListener', removeListener);
dest.on('removeListener', __forward_emitter_removeListener);
function removeListener(eventName, listener) {
src.removeListener(eventName, listener);
}
};
{
"name": "forward-emitter",
"version": "0.1.0",
"version": "0.1.1",
"description": "Forward events from any Node EventEmitter to another EventEmitter.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -67,2 +67,3 @@ 'use strict';

var src3 = new EventEmitter();
var src4 = new EventEmitter();
var dest = new EventEmitter();

@@ -72,2 +73,3 @@ forward(src1, dest);

forward(src3, dest);
forward(src4, dest);

@@ -74,0 +76,0 @@ done();