Socket
Socket
Sign inDemoInstall

eventemitter3

Package Overview
Dependencies
Maintainers
3
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eventemitter3 - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

32

index.d.ts

@@ -1,5 +0,1 @@

export as namespace EventEmitter;
type ListenerFn = (...args: Array<any>) => void;
/**

@@ -9,3 +5,3 @@ * Minimal `EventEmitter` interface that is molded against the Node.js

*/
export class EventEmitter {
declare class EventEmitter {
static prefixed: string | boolean;

@@ -22,3 +18,3 @@

*/
listeners(event: string | symbol): Array<ListenerFn>;
listeners(event: string | symbol): Array<EventEmitter.ListenerFn>;

@@ -38,4 +34,4 @@ /**

*/
on(event: string | symbol, fn: ListenerFn, context?: any): this;
addListener(event: string | symbol, fn: ListenerFn, context?: any): this;
on(event: string | symbol, fn: EventEmitter.ListenerFn, context?: any): this;
addListener(event: string | symbol, fn: EventEmitter.ListenerFn, context?: any): this;

@@ -45,3 +41,3 @@ /**

*/
once(event: string | symbol, fn: ListenerFn, context?: any): this;
once(event: string | symbol, fn: EventEmitter.ListenerFn, context?: any): this;

@@ -51,4 +47,4 @@ /**

*/
removeListener(event: string | symbol, fn?: ListenerFn, context?: any, once?: boolean): this;
off(event: string | symbol, fn?: ListenerFn, context?: any, once?: boolean): this;
removeListener(event: string | symbol, fn?: EventEmitter.ListenerFn, context?: any, once?: boolean): this;
off(event: string | symbol, fn?: EventEmitter.ListenerFn, context?: any, once?: boolean): this;

@@ -60,1 +56,15 @@ /**

}
declare namespace EventEmitter {
export interface ListenerFn {
(...args: Array<any>): void;
}
export interface EventEmitterStatic {
new(): EventEmitter;
}
export const EventEmitter: EventEmitterStatic;
}
export = EventEmitter;
{
"name": "eventemitter3",
"version": "3.0.0",
"version": "3.0.1",
"description": "EventEmitter3 focuses on performance while maintaining a Node.js AND browser compatible interface.",

@@ -47,10 +47,10 @@ "main": "index.js",

"assume": "~1.5.0",
"browserify": "~14.5.0",
"mocha": "~4.0.0",
"nyc": "~11.3.0",
"browserify": "~15.2.0",
"mocha": "~5.0.0",
"nyc": "~11.4.1",
"pre-commit": "~1.2.0",
"sauce-browsers": "~1.0.0",
"sauce-test": "~1.3.3",
"uglify-js": "~3.2.0"
"uglify-js": "~3.3.0"
}
}

@@ -1,1 +0,1 @@

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).EventEmitter3=e()}}(function(){return function e(t,n,r){function o(s,f){if(!n[s]){if(!t[s]){var c="function"==typeof require&&require;if(!f&&c)return c(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var a=n[s]={exports:{}};t[s][0].call(a.exports,function(e){var n=t[s][1][e];return o(n||e)},a,a.exports,e,t,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)o(r[s]);return o}({1:[function(e,t,n){"use strict";function r(){}function o(e,t,n,r,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var i=new function(e,t,n){this.fn=e,this.context=t,this.once=n||!1}(n,r||e,o),s=c?c+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],i]:e._events[s].push(i):(e._events[s]=i,e._eventsCount++),e}function i(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}var f=Object.prototype.hasOwnProperty,c="~";Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(c=!1)),s.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)f.call(e,t)&&n.push(c?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},s.prototype.listeners=function(e){var t=c?c+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,o=n.length,i=new Array(o);r<o;r++)i[r]=n[r].fn;return i},s.prototype.listenerCount=function(e){var t=c?c+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,r,o,i){var s=c?c+e:e;if(!this._events[s])return!1;var f,u,a=this._events[s],l=arguments.length;if(a.fn){switch(a.once&&this.removeListener(e,a.fn,void 0,!0),l){case 1:return a.fn.call(a.context),!0;case 2:return a.fn.call(a.context,t),!0;case 3:return a.fn.call(a.context,t,n),!0;case 4:return a.fn.call(a.context,t,n,r),!0;case 5:return a.fn.call(a.context,t,n,r,o),!0;case 6:return a.fn.call(a.context,t,n,r,o,i),!0}for(u=1,f=new Array(l-1);u<l;u++)f[u-1]=arguments[u];a.fn.apply(a.context,f)}else{var p,v=a.length;for(u=0;u<v;u++)switch(a[u].once&&this.removeListener(e,a[u].fn,void 0,!0),l){case 1:a[u].fn.call(a[u].context);break;case 2:a[u].fn.call(a[u].context,t);break;case 3:a[u].fn.call(a[u].context,t,n);break;case 4:a[u].fn.call(a[u].context,t,n,r);break;default:if(!f)for(p=1,f=new Array(l-1);p<l;p++)f[p-1]=arguments[p];a[u].fn.apply(a[u].context,f)}}return!0},s.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,n,r){var o=c?c+e:e;if(!this._events[o])return this;if(!t)return i(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||r&&!s.once||n&&s.context!==n||i(this,o);else{for(var f=0,u=[],a=s.length;f<a;f++)(s[f].fn!==t||r&&!s[f].once||n&&s[f].context!==n)&&u.push(s[f]);u.length?this._events[o]=1===u.length?u[0]:u:i(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=c?c+e:e,this._events[t]&&i(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=c,s.EventEmitter=s,void 0!==t&&(t.exports=s)},{}]},{},[1])(1)});
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).EventEmitter3=e()}}(function(){return function e(t,n,r){function o(s,f){if(!n[s]){if(!t[s]){var c="function"==typeof require&&require;if(!f&&c)return c(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var a=n[s]={exports:{}};t[s][0].call(a.exports,function(e){var n=t[s][1][e];return o(n||e)},a,a.exports,e,t,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)o(r[s]);return o}({1:[function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,o="~";function i(){}function s(e,t,n,r,i){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new function(e,t,n){this.fn=e,this.context=t,this.once=n||!1}(n,r||e,i),f=o?o+t:t;return e._events[f]?e._events[f].fn?e._events[f]=[e._events[f],s]:e._events[f].push(s):(e._events[f]=s,e._eventsCount++),e}function f(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(o=!1)),c.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)r.call(e,t)&&n.push(o?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},c.prototype.listeners=function(e){var t=o?o+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,i=n.length,s=new Array(i);r<i;r++)s[r]=n[r].fn;return s},c.prototype.listenerCount=function(e){var t=o?o+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,r,i,s){var f=o?o+e:e;if(!this._events[f])return!1;var c,u,a=this._events[f],l=arguments.length;if(a.fn){switch(a.once&&this.removeListener(e,a.fn,void 0,!0),l){case 1:return a.fn.call(a.context),!0;case 2:return a.fn.call(a.context,t),!0;case 3:return a.fn.call(a.context,t,n),!0;case 4:return a.fn.call(a.context,t,n,r),!0;case 5:return a.fn.call(a.context,t,n,r,i),!0;case 6:return a.fn.call(a.context,t,n,r,i,s),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];a.fn.apply(a.context,c)}else{var p,v=a.length;for(u=0;u<v;u++)switch(a[u].once&&this.removeListener(e,a[u].fn,void 0,!0),l){case 1:a[u].fn.call(a[u].context);break;case 2:a[u].fn.call(a[u].context,t);break;case 3:a[u].fn.call(a[u].context,t,n);break;case 4:a[u].fn.call(a[u].context,t,n,r);break;default:if(!c)for(p=1,c=new Array(l-1);p<l;p++)c[p-1]=arguments[p];a[u].fn.apply(a[u].context,c)}}return!0},c.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,r){var i=o?o+e:e;if(!this._events[i])return this;if(!t)return f(this,i),this;var s=this._events[i];if(s.fn)s.fn!==t||r&&!s.once||n&&s.context!==n||f(this,i);else{for(var c=0,u=[],a=s.length;c<a;c++)(s[c].fn!==t||r&&!s[c].once||n&&s[c].context!==n)&&u.push(s[c]);u.length?this._events[i]=1===u.length?u[0]:u:f(this,i)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=o?o+e:e,this._events[t]&&f(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=o,c.EventEmitter=c,void 0!==t&&(t.exports=c)},{}]},{},[1])(1)});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc