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

emmett

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emmett - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

29

emmett.js

@@ -196,2 +196,3 @@ (function() {

handlersList = this._handlers[event];
bindingObject.type = event;
}

@@ -214,5 +215,2 @@ else if (event instanceof RegExp) {

if (bindingObject.once)
bindingObject.parent = handlersList;
handlersList.push(bindingObject);

@@ -307,6 +305,3 @@ }

n,
j,
m,
k,
a,
event;

@@ -431,2 +426,3 @@

event,
parent,
handlers,

@@ -459,4 +455,11 @@ handler,

// Cleaning onces
for (j = onces.length - 1; j >= 0; j--)
onces[j].parent.splice(onces[j].parent.indexOf(onces[j]), 1);
for (j = onces.length - 1; j >= 0; j--) {
parent = onces[j].type ?
this._handlers[onces[j].type] :
onces[j].pattern ?
this._handlersComplex :
this._handlersAll;
parent.splice(parent.indexOf(onces[j]), 1);
}
}

@@ -479,2 +482,10 @@

this._enabled = false;
// Nooping methods
this.unbindAll =
this.on =
this.once =
this.off =
this.emit =
this.listeners = Function.prototype;
};

@@ -511,3 +522,3 @@

*/
Emitter.version = '3.0.0';
Emitter.version = '3.0.1';

@@ -514,0 +525,0 @@

/**
* emmett - A custom event emitter for Node.js and the browser.
* @version v3.0.0
* @version v3.0.1
* @link https://github.com/jacomyal/emmett
* @license MIT
*/
(function(){"use strict";function e(e,t){var n,r={};for(n in e)r[n]=e[n];for(n in t)r[n]=t[n];return r}function t(e){return!(!e||"object"!=typeof e||Array.isArray(e)||e instanceof Function||e instanceof RegExp)}function n(e,t){e=e||[];var n,r,s=[];for(r=0,n=e.length;n>r;r++)e[r].fn!==t&&s.push(e[r]);return s}var r={once:"boolean",scope:"object"},s=0,i=function(){this._enabled=!0,this.unbindAll()};i.prototype.unbindAll=function(){return this._handlers={},this._handlersAll=[],this._handlersComplex=[],this},i.prototype.on=function(e,n,i){var l,o,h,a,f,d,u;if(t(e)){for(a in e)this.on(a,e[a],n);return this}for("function"==typeof e&&(i=n,n=e,e=null),f=[].concat(e),l=0,o=f.length;o>l;l++){if(a=f[l],u={order:s++,fn:n},"string"==typeof a)this._handlers[a]||(this._handlers[a]=[]),d=this._handlers[a];else if(a instanceof RegExp)d=this._handlersComplex,u.pattern=a;else{if(null!==a)throw Error("Emitter.on: invalid event.");d=this._handlersAll}for(h in i||{})r[h]&&(u[h]=i[h]);u.once&&(u.parent=d),d.push(u)}return this},i.prototype.once=function(){var n=Array.prototype.slice.call(arguments),r=n.length-1;return t(n[r])&&n.length>1?n[r]=e(n[r],{once:!0}):n.push({once:!0}),this.on.apply(this,n)},i.prototype.off=function(e,r){var s,i,l,o;if(1===arguments.length&&"function"==typeof e){r=arguments[0];for(l in this._handlers)this._handlers[l]=n(this._handlers[l],r),0===this._handlers[l].length&&delete this._handlers[l];this._handlersAll=n(this._handlersAll,r),this._handlersComplex=n(this._handlersComplex,r)}else if(1===arguments.length&&"string"==typeof e)delete this._handlers[e];else if(2===arguments.length){var h=[].concat(e);for(s=0,i=h.length;i>s;s++)o=h[s],this._handlers[o]=n(this._handlers[o],r),0===(this._handlers[o]||[]).length&&delete this._handlers[o]}else if(t(e))for(l in e)this.off(l,e[l]);return this},i.prototype.listeners=function(e){var t,n,r,s=this._handlersAll||[],i=!1;if(!e)throw Error("Emitter.listeners: no event provided.");for(s=s.concat(this._handlers[e]||[]),n=0,r=this._handlersComplex.length;r>n;n++)t=this._handlersComplex[n],~e.search(t.pattern)&&(i=!0,s.push(t));return this._handlersAll.length||i?s.sort(function(e,t){return e.order-t.order}):s.slice(0)},i.prototype.emit=function(e,n){if(!this._enabled)return this;if(t(e)){for(var r in e)this.emit(r,e[r]);return this}var s,i,l,o,h,a,f,d=[].concat(e),u=[];for(o=0,a=d.length;a>o;o++){for(i=this.listeners(d[o]),h=0,f=i.length;f>h;h++)l=i[h],s={type:d[o],target:this},arguments.length>1&&(s.data=n),l.fn.call("scope"in l?l.scope:this,s),l.once&&u.push(l);for(h=u.length-1;h>=0;h--)u[h].parent.splice(u[h].parent.indexOf(u[h]),1)}return this},i.prototype.kill=function(){this.unbindAll(),this._handlers=null,this._handlersAll=null,this._handlersComplex=null,this._enabled=!1},i.prototype.disable=function(){return this._enabled=!1,this},i.prototype.enable=function(){return this._enabled=!0,this},i.version="3.0.0","undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=i),exports.Emitter=i):"function"==typeof define&&define.amd?define("emmett",[],function(){return i}):this.Emitter=i}).call(this);
(function(){"use strict";function t(t,e){var n,r={};for(n in t)r[n]=t[n];for(n in e)r[n]=e[n];return r}function e(t){return!(!t||"object"!=typeof t||Array.isArray(t)||t instanceof Function||t instanceof RegExp)}function n(t,e){t=t||[];var n,r,s=[];for(r=0,n=t.length;n>r;r++)t[r].fn!==e&&s.push(t[r]);return s}var r={once:"boolean",scope:"object"},s=0,i=function(){this._enabled=!0,this.unbindAll()};i.prototype.unbindAll=function(){return this._handlers={},this._handlersAll=[],this._handlersComplex=[],this},i.prototype.on=function(t,n,i){var l,h,o,a,f,d,p;if(e(t)){for(a in t)this.on(a,t[a],n);return this}for("function"==typeof t&&(i=n,n=t,t=null),f=[].concat(t),l=0,h=f.length;h>l;l++){if(a=f[l],p={order:s++,fn:n},"string"==typeof a)this._handlers[a]||(this._handlers[a]=[]),d=this._handlers[a],p.type=a;else if(a instanceof RegExp)d=this._handlersComplex,p.pattern=a;else{if(null!==a)throw Error("Emitter.on: invalid event.");d=this._handlersAll}for(o in i||{})r[o]&&(p[o]=i[o]);d.push(p)}return this},i.prototype.once=function(){var n=Array.prototype.slice.call(arguments),r=n.length-1;return e(n[r])&&n.length>1?n[r]=t(n[r],{once:!0}):n.push({once:!0}),this.on.apply(this,n)},i.prototype.off=function(t,r){var s,i,l,h;if(1===arguments.length&&"function"==typeof t){r=arguments[0];for(l in this._handlers)this._handlers[l]=n(this._handlers[l],r),0===this._handlers[l].length&&delete this._handlers[l];this._handlersAll=n(this._handlersAll,r),this._handlersComplex=n(this._handlersComplex,r)}else if(1===arguments.length&&"string"==typeof t)delete this._handlers[t];else if(2===arguments.length){var o=[].concat(t);for(s=0,i=o.length;i>s;s++)h=o[s],this._handlers[h]=n(this._handlers[h],r),0===(this._handlers[h]||[]).length&&delete this._handlers[h]}else if(e(t))for(l in t)this.off(l,t[l]);return this},i.prototype.listeners=function(t){var e,n,r,s=this._handlersAll||[],i=!1;if(!t)throw Error("Emitter.listeners: no event provided.");for(s=s.concat(this._handlers[t]||[]),n=0,r=this._handlersComplex.length;r>n;n++)e=this._handlersComplex[n],~t.search(e.pattern)&&(i=!0,s.push(e));return this._handlersAll.length||i?s.sort(function(t,e){return t.order-e.order}):s.slice(0)},i.prototype.emit=function(t,n){if(!this._enabled)return this;if(e(t)){for(var r in t)this.emit(r,t[r]);return this}var s,i,l,h,o,a,f,d,p=[].concat(t),u=[];for(o=0,f=p.length;f>o;o++){for(l=this.listeners(p[o]),a=0,d=l.length;d>a;a++)h=l[a],s={type:p[o],target:this},arguments.length>1&&(s.data=n),h.fn.call("scope"in h?h.scope:this,s),h.once&&u.push(h);for(a=u.length-1;a>=0;a--)i=u[a].type?this._handlers[u[a].type]:u[a].pattern?this._handlersComplex:this._handlersAll,i.splice(i.indexOf(u[a]),1)}return this},i.prototype.kill=function(){this.unbindAll(),this._handlers=null,this._handlersAll=null,this._handlersComplex=null,this._enabled=!1,this.unbindAll=this.on=this.once=this.off=this.emit=this.listeners=Function.prototype},i.prototype.disable=function(){return this._enabled=!1,this},i.prototype.enable=function(){return this._enabled=!0,this},i.version="3.0.1","undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=i),exports.Emitter=i):"function"==typeof define&&define.amd?define("emmett",[],function(){return i}):this.Emitter=i}).call(this);
The MIT License (MIT)
Copyright (c) 2014 Alexis Jacomy - @jacomyal
Copyright (c) 2014-2015 Alexis Jacomy - @jacomyal

@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

{
"name": "emmett",
"version": "3.0.0",
"version": "3.0.1",
"description": "A custom event emitter for Node.js and the browser.",

@@ -5,0 +5,0 @@ "main": "emmett.js",

@@ -39,3 +39,3 @@ # Emmett

helpers.inherits(MyObject, Emitter);
util.inherits(MyObject, Emitter);
```

@@ -42,0 +42,0 @@

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