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

propagate

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

propagate - npm Package Compare versions

Comparing version 0.4.0 to 1.0.0

.travis.yml

3

index.js

@@ -19,6 +19,7 @@ function propagate(events, source, dest) {

source.emit = function(eventType) {
oldEmit.apply(source, arguments);
if (! events || ~events.indexOf(eventType)) {
dest.emit.apply(dest, arguments);
}
oldEmit.apply(source, arguments);
}

@@ -25,0 +26,0 @@

{
"name": "propagate",
"description": "Propagate events",
"version": "0.4.0",
"version": "1.0.0",
"author" : "Pedro Teixeira <pedro.teixeira@gmail.com>",

@@ -6,0 +6,0 @@ "contributors" : [

# propagate
[![Build Status](https://travis-ci.org/pgte/propagate.svg?branch=master)](https://travis-ci.org/pgte/propagate)
Propagate events from one event emitter into another

@@ -4,0 +6,0 @@

@@ -62,2 +62,23 @@ var test = require('tap').test;

test('emit on source before destination', function (t) {
t.plan(1);
var source = new EventEmitter();
var dest = new EventEmitter();
// Set up test case for "propagate all"
// `count` should have been incremented by handler on source when handler on dest is invoked
var count = 0;
propagate(source, dest);
source.on('event', function () {
count++;
});
dest.on('event', function () {
t.equal(count, 1, 'emit on source first');
});
// Emit the events for assertion
source.emit('event');
});
test('is able to propagate only certain events', function(t) {

@@ -120,2 +141,2 @@ t.plan(2);

ee1.emit('event-1');
});
});
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