Huge News!Announcing our $40M Series B led by Abstract Ventures.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

Forward events from any Node EventEmitter to another EventEmitter.

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Forward-emitter

Forward events from one Node EventEmitter to another.

Installation

npm install forward-emitter

Usage

var forward = require('forward-emitter');

// Basic forwarding
forward(src, dest);

// Forward only selected events
// In this example, only the 'connect' event is forwarded.
forward(src, dest, function (eventName) {
  return eventName === 'connect';
});

// Forward all events except exclusions
var exclusions = ['connect', 'disconnect'];
forward(src, dest, function(eventName) {
  return exclusions.indexOf(eventName) === -1;
});

How It Works

forward-emitter listens to the newListener and removeListener events, introduced in Node 0.8 and Node 0.10 respectively. When a callback is bound to an event on the destination emitter, the listener is forwarded to the source emitter.

For that reason, this module should not be used in Node < 0.10 if you plan to use removeListener.

Keywords

FAQs

Package last updated on 30 Jun 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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