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

event-emitter

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

event-emitter - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

2

package.json
{
"name": "event-emitter",
"version": "0.3.0",
"version": "0.3.1",
"description": "Environment agnostic event emitter",

@@ -5,0 +5,0 @@ "author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)",

'use strict';
var defineProperty = Object.defineProperty
, aFrom = require('es5-ext/array/from')
var aFrom = require('es5-ext/array/from')
, remove = require('es5-ext/array/#/remove')
, value = require('es5-ext/object/valid-object')
, d = require('d')
, value = require('es5-ext/object/valid-object')
, emit = require('./').methods.emit
, defineProperty = Object.defineProperty
, hasOwnProperty = Object.prototype.hasOwnProperty
, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
module.exports = function (e1, e2) {
var pipes, pipe, desc;
module.exports = function (e1, e2/*, name*/) {
var pipes, pipe, desc, name;
(value(e1) && value(e2));
if (typeof e1.emit !== 'function') {
throw new TypeError(e1 + ' is not emitter');
}
name = arguments[2];
if (name === undefined) name = 'emit';

@@ -28,6 +27,10 @@ pipe = {

}
defineProperty(e1, '__eePipes__', d(pipes = [e2]));
desc = getOwnPropertyDescriptor(e1, 'emit');
delete desc.get;
delete desc.set;
defineProperty(e1, '__eePipes__', d('c', pipes = [e2]));
desc = getOwnPropertyDescriptor(e1, name);
if (!desc) {
desc = d('c', undefined);
} else {
delete desc.get;
delete desc.set;
}
desc.value = function () {

@@ -38,4 +41,4 @@ var i, emitter, data = aFrom(pipes);

};
defineProperty(e1, 'emit', desc);
defineProperty(e1, name, desc);
return pipe;
};

@@ -58,6 +58,7 @@ # event-emitter

#### pipe(source, target) _(event-emitter/pipe)_
#### pipe(source, target/*, emitMethodName*/) _(event-emitter/pipe)_
Pipes all events from _source_ emitter onto _target_ emitter (all events from _source_ emitter will be emitted also on _target_ emitter, but not other way).
Returns _pipe_ object which exposes `pipe.close` function. Invoke it to close configured _pipe_.
Returns _pipe_ object which exposes `pipe.close` function. Invoke it to close configured _pipe_.
It works internally by redefinition of `emit` method, if in your interface this method is referenced differenetly, provide its name (or symbol) with third argument.

@@ -64,0 +65,0 @@ #### unify(emitter1, emitter2) _(event-emitter/unify)_

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

ee(x);
x = Object.create(x);
ee(y);

@@ -11,0 +12,0 @@ ee(z);

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