contra.emitter
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "contra.emitter", | ||
"description": "A sane event emitter component", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"homepage": "https://github.com/bevacqua/contra.emitter", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -0,1 +1,5 @@ | ||
# 1.6.9 Context Mayhem | ||
- Fixed an issue where you weren't able to change the event context using `.apply` on event emissions | ||
# 1.6.8 Cascade of Events | ||
@@ -2,0 +6,0 @@ |
/** | ||
* contra.emitter - A sane event emitter component | ||
* @version v1.0.0 | ||
* @version v1.0.1 | ||
* @link https://github.com/bevacqua/contra.emitter | ||
@@ -55,2 +55,3 @@ * @license MIT | ||
thing.emit = function () { | ||
var ctx = this; | ||
var args = atoa(arguments); | ||
@@ -62,3 +63,3 @@ var type = args.shift(); | ||
evt[type] = et.filter(function emitter (listen) { | ||
if (opts.async) { debounce(listen, args, thing); } else { listen.apply(thing, args); } | ||
if (opts.async) { debounce(listen, args, ctx); } else { listen.apply(ctx, args); } | ||
return !listen._once; | ||
@@ -65,0 +66,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
// contra.emitter@v1.0.0, 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),o=e.shift(),c=u[o];if("error"===o&&i.throws!==!1&&!c)throw 1===e.length?e[0]:e;return c?(u[o]=c.filter(function(n){return i.async?r(n,e,t):n.apply(t,e),!n._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.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 - A sane event emitter component | ||
* @version v1.0.0 | ||
* @version v1.0.1 | ||
* @link https://github.com/bevacqua/contra.emitter | ||
@@ -5,0 +5,0 @@ * @license MIT |
@@ -1,2 +0,2 @@ | ||
// contra.emitter@v1.0.0, MIT licensed. https://github.com/bevacqua/contra.emitter | ||
// contra.emitter@v1.0.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.0.0", | ||
"version": "1.0.1", | ||
"homepage": "https://github.com/bevacqua/contra.emitter", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -49,2 +49,3 @@ (function (root, undefined) { | ||
thing.emit = function () { | ||
var ctx = this; | ||
var args = atoa(arguments); | ||
@@ -56,3 +57,3 @@ var type = args.shift(); | ||
evt[type] = et.filter(function emitter (listen) { | ||
if (opts.async) { debounce(listen, args, thing); } else { listen.apply(thing, args); } | ||
if (opts.async) { debounce(listen, args, ctx); } else { listen.apply(ctx, args); } | ||
return !listen._once; | ||
@@ -59,0 +60,0 @@ }); |
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
17132
296