Comparing version 0.4.0 to 1.0.0
@@ -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'); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
7387
7
169
1
62