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

contra.emitter

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

contra.emitter - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

2

bower.json
{
"name": "contra.emitter",
"description": "A sane event emitter component",
"version": "1.0.1",
"version": "1.0.2",
"homepage": "https://github.com/bevacqua/contra.emitter",

@@ -6,0 +6,0 @@ "author": {

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

# 1.1.1 Snapchat
- Fixed a use case where the consumer turned the emitter `.off` from within the event listener
# 1.1.0 Snapshot

@@ -2,0 +6,0 @@

/**
* contra.emitter - A sane event emitter component
* @version v1.0.1
* @version v1.1.1
* @link https://github.com/bevacqua/contra.emitter

@@ -55,14 +55,18 @@ * @license MIT

thing.emit = function () {
var ctx = this;
var args = atoa(arguments);
var type = args.shift();
var et = evt[type];
if (type === 'error' && opts.throws !== false && !et) { throw args.length === 1 ? args[0] : args; }
if (!et) { return thing; }
evt[type] = et.filter(function emitter (listen) {
if (opts.async) { debounce(listen, args, ctx); } else { listen.apply(ctx, args); }
return !listen._once;
});
return thing;
return thing.emitterSnapshot(args.shift()).apply(this, args);
};
thing.emitterSnapshot = function (type) {
var et = (evt[type] || []).slice(0);
return function () {
var args = atoa(arguments);
var ctx = this || thing;
if (type === 'error' && opts.throws !== false && !et.length) { throw args.length === 1 ? args[0] : args; }
et.forEach(function emitter (listen) {
if (opts.async) { debounce(listen, args, ctx); } else { listen.apply(ctx, args); }
if (listen._once) { thing.off(type, listen); }
});
return thing;
};
}
return thing;

@@ -69,0 +73,0 @@ }

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

// contra.emitter@v1.0.1, MIT licensed. https://github.com/bevacqua/contra.emitter
!function(t,e){"use strict";function n(t,e){return Array.prototype.slice.call(t,e)}function r(t,e,n){t&&i(function(){t.apply(n||null,e||[])})}function o(t,o){var i=o||{},u={};return t===e&&(t={}),t.on=function(e,n){return u[e]?u[e].push(n):u[e]=[n],t},t.once=function(e,n){return n._once=!0,t.on(e,n),t},t.off=function(e,n){var r=arguments.length;if(1===r)delete u[e];else if(0===r)u={};else{var o=u[e];if(!o)return t;o.splice(o.indexOf(n),1)}return t},t.emit=function(){var e=this,o=n(arguments),c=o.shift(),f=u[c];if("error"===c&&i.throws!==!1&&!f)throw 1===o.length?o[0]:o;return f?(u[c]=f.filter(function(t){return i.async?r(t,o,e):t.apply(e,o),!t._once}),t):t},t}var i,u=""+e,c="function"==typeof setImmediate;i=c?function(t){setImmediate(t)}:typeof process!==u&&process.nextTick?process.nextTick:function(t){setTimeout(t,0)},typeof module!==u&&module.exports?module.exports=o:(t.contra=t.contra||{},t.contra.emitter=o)}(this);
// contra.emitter@v1.1.1, MIT licensed. https://github.com/bevacqua/contra.emitter
!function(t,e){"use strict";function n(t,e){return Array.prototype.slice.call(t,e)}function r(t,e,n){t&&i(function(){t.apply(n||null,e||[])})}function o(t,o){var i=o||{},u={};return t===e&&(t={}),t.on=function(e,n){return u[e]?u[e].push(n):u[e]=[n],t},t.once=function(e,n){return n._once=!0,t.on(e,n),t},t.off=function(e,n){var r=arguments.length;if(1===r)delete u[e];else if(0===r)u={};else{var o=u[e];if(!o)return t;o.splice(o.indexOf(n),1)}return t},t.emit=function(){var e=n(arguments);return t.emitterSnapshot(e.shift()).apply(this,e)},t.emitterSnapshot=function(e){var o=(u[e]||[]).slice(0);return function(){var u=n(arguments),c=this||t;if("error"===e&&i.throws!==!1&&!o.length)throw 1===u.length?u[0]:u;return o.forEach(function(n){i.async?r(n,u,c):n.apply(c,u),n._once&&t.off(e,n)}),t}},t}var i,u=""+e,c="function"==typeof setImmediate;i=c?function(t){setImmediate(t)}:typeof process!==u&&process.nextTick?process.nextTick:function(t){setTimeout(t,0)},typeof module!==u&&module.exports?module.exports=o:(t.contra=t.contra||{},t.contra.emitter=o)}(this);
/**
* contra.emitter - A sane event emitter component
* @version v1.0.1
* @version v1.1.1
* @link https://github.com/bevacqua/contra.emitter

@@ -5,0 +5,0 @@ * @license MIT

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

// contra.emitter@v1.0.1, MIT licensed. https://github.com/bevacqua/contra.emitter
// contra.emitter@v1.1.1, MIT licensed. https://github.com/bevacqua/contra.emitter
!function(t){"use strict";t.prototype.filter||(t.prototype.filter=function(t,r){var o=[];return this.forEach(function(i,n,c){t.call(r,i,n,c)&&o.push(i)},r),o})}(Array);
{
"name": "contra.emitter",
"description": "A sane event emitter component",
"version": "1.1.0",
"version": "1.1.1",
"homepage": "https://github.com/bevacqua/contra.emitter",

@@ -6,0 +6,0 @@ "author": {

@@ -58,5 +58,5 @@ (function (root, undefined) {

if (type === 'error' && opts.throws !== false && !et.length) { throw args.length === 1 ? args[0] : args; }
evt[type] = et.filter(function emitter (listen) {
et.forEach(function emitter (listen) {
if (opts.async) { debounce(listen, args, ctx); } else { listen.apply(ctx, args); }
return !listen._once;
if (listen._once) { thing.off(type, listen); }
});

@@ -63,0 +63,0 @@ return thing;

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