event-emitter-grouped
Advanced tools
Comparing version 2.3.2 to 2.3.3
@@ -1,4 +0,4 @@ | ||
// Generated by CoffeeScript 1.6.3 | ||
// Generated by CoffeeScript 1.7.1 | ||
(function() { | ||
var EventEmitterGrouped, TaskGroup, ambi, attach, events, inheritInto, _ref, | ||
var EventEmitterGrouped, TaskGroup, ambi, attach, events, inheritInto, | ||
__hasProp = {}.hasOwnProperty, | ||
@@ -18,23 +18,30 @@ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
function EventEmitterGrouped() { | ||
_ref = EventEmitterGrouped.__super__.constructor.apply(this, arguments); | ||
return _ref; | ||
return EventEmitterGrouped.__super__.constructor.apply(this, arguments); | ||
} | ||
EventEmitterGrouped.prototype.getListenerGroup = function() { | ||
var args, eventName, listeners, me, next, tasks, _i; | ||
var args, eventName, listenerObjects, me, next, tasks, _i; | ||
eventName = arguments[0], args = 3 <= arguments.length ? __slice.call(arguments, 1, _i = arguments.length - 1) : (_i = 1, []), next = arguments[_i++]; | ||
me = this; | ||
listeners = this.listeners(eventName); | ||
tasks = new TaskGroup().once('complete', next); | ||
listeners.sort(function(a, b) { | ||
return (b.priority || 0) - (a.priority || 0); | ||
}); | ||
listeners.forEach(function(listener) { | ||
tasks = new TaskGroup("EventEmitterGrouped for " + eventName).once('complete', next); | ||
listenerObjects = this.listeners(eventName).slice().map(function(listener) { | ||
var listenerObject; | ||
listenerObject = {}; | ||
if (listener.listener) { | ||
listener = [listener.bind(me), listener.listener]; | ||
listenerObject.actual = listener.listener; | ||
listenerObject.fire = [listener.bind(me), listener.listener]; | ||
} else { | ||
listener = listener.bind(me); | ||
listenerObject.actual = listener; | ||
listenerObject.fire = listener.bind(me); | ||
} | ||
return tasks.addTask(function(complete) { | ||
return ambi.apply(null, [listener].concat(__slice.call(args), [complete])); | ||
listenerObject.priority = listenerObject.actual.priority || 0; | ||
listenerObject.name = listenerObject.name || ("Untitled listener for [" + eventName + "] with priority [" + listenerObject.priority + "]"); | ||
return listenerObject; | ||
}); | ||
listenerObjects.sort(function(a, b) { | ||
return b.priority - a.priority; | ||
}); | ||
listenerObjects.forEach(function(listenerObject) { | ||
return tasks.addTask(listenerObject.name, function(complete) { | ||
return ambi.apply(null, [listenerObject.fire].concat(__slice.call(args), [complete])); | ||
}); | ||
@@ -70,7 +77,7 @@ }); | ||
attach = function(somethingElse) { | ||
var key, value, _ref1; | ||
_ref1 = EventEmitterGrouped.prototype; | ||
for (key in _ref1) { | ||
if (!__hasProp.call(_ref1, key)) continue; | ||
value = _ref1[key]; | ||
var key, value, _ref; | ||
_ref = EventEmitterGrouped.prototype; | ||
for (key in _ref) { | ||
if (!__hasProp.call(_ref, key)) continue; | ||
value = _ref[key]; | ||
somethingElse[key] = value; | ||
@@ -77,0 +84,0 @@ } |
{ | ||
"title": "Event Emitter Grouped", | ||
"name": "event-emitter-grouped", | ||
"version": "2.3.2", | ||
"version": "2.3.3", | ||
"description": "Emit events in serial or parallel with support for synchronous and asynchronous listeners", | ||
@@ -13,5 +13,8 @@ "homepage": "https://github.com/bevry/event-emitter-grouped", | ||
"npm": true, | ||
"david": true, | ||
"daviddev": true, | ||
"gittip": "bevry", | ||
"flattr": "344188/balupton-on-Flattr", | ||
"paypal": "QB8GQPZAH84N6" | ||
"paypal": "QB8GQPZAH84N6", | ||
"bitcoin": "https://coinbase.com/checkouts/9ef59f5479eec1d97d63382c9ebcb93a" | ||
}, | ||
@@ -51,10 +54,10 @@ "keywords": [ | ||
"ambi": "~2.1.6", | ||
"taskgroup": "~3.3.1" | ||
"taskgroup": "~3.3.7" | ||
}, | ||
"devDependencies": { | ||
"coffee-script": "~1.6.2", | ||
"coffee-script": "~1.7.1", | ||
"joe": "~1.3.0", | ||
"joe-reporter-console": "~1.2.1", | ||
"chai": "~1.8.1", | ||
"projectz": "~0.2.3" | ||
"chai": "~1.9.0", | ||
"projectz": "~0.3.9" | ||
}, | ||
@@ -61,0 +64,0 @@ "directories": { |
@@ -13,5 +13,8 @@ | ||
[![NPM version](http://badge.fury.io/js/event-emitter-grouped.png)](https://npmjs.org/package/event-emitter-grouped "View this project on NPM") | ||
[![Dependency Status](https://david-dm.org/bevry/event-emitter-grouped.png?theme=shields.io)](https://david-dm.org/bevry/event-emitter-grouped) | ||
[![Development Dependency Status](https://david-dm.org/bevry/event-emitter-grouped/dev-status.png?theme=shields.io)](https://david-dm.org/bevry/event-emitter-grouped#info=devDependencies)<br/> | ||
[![Gittip donate button](http://img.shields.io/gittip/bevry.png)](https://www.gittip.com/bevry/ "Donate weekly to this project using Gittip") | ||
[![Flattr donate button](http://img.shields.io/flattr/donate.png?color=yellow)](http://flattr.com/thing/344188/balupton-on-Flattr "Donate monthly to this project using Flattr") | ||
[![PayPayl donate button](http://img.shields.io/paypal/donate.png?color=yellow)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QB8GQPZAH84N6 "Donate once-off to this project using Paypal") | ||
[![BitCoin donate button](http://img.shields.io/bitcoin/donate.png?color=yellow)](https://coinbase.com/checkouts/9ef59f5479eec1d97d63382c9ebcb93a "Donate once-off to this project using BitCoin") | ||
@@ -32,10 +35,6 @@ <!-- /BADGES --> | ||
### [Node](http://nodejs.org/), [Browserify](http://browserify.org/) | ||
### [Node](http://nodejs.org/) | ||
- Use: `require('event-emitter-grouped')` | ||
- Install: `npm install --save event-emitter-grouped` | ||
### [Ender](http://ender.jit.su/) | ||
- Use: `require('event-emitter-grouped')` | ||
- Install: `ender add event-emitter-grouped` | ||
<!-- /INSTALL --> | ||
@@ -118,3 +117,3 @@ | ||
## History | ||
[Discover the change history by heading on over to the `History.md` file.](https://github.com/bevry/event-emitter-grouped/blob/master/History.md#files) | ||
[Discover the change history by heading on over to the `HISTORY.md` file.](https://github.com/bevry/event-emitter-grouped/blob/master/HISTORY.md#files) | ||
@@ -128,3 +127,3 @@ <!-- /HISTORY --> | ||
[Discover how you can contribute by heading on over to the `Contributing.md` file.](https://github.com/bevry/event-emitter-grouped/blob/master/Contributing.md#files) | ||
[Discover how you can contribute by heading on over to the `CONTRIBUTING.md` file.](https://github.com/bevry/event-emitter-grouped/blob/master/CONTRIBUTING.md#files) | ||
@@ -151,2 +150,3 @@ <!-- /CONTRIBUTE --> | ||
[![PayPayl donate button](http://img.shields.io/paypal/donate.png?color=yellow)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QB8GQPZAH84N6 "Donate once-off to this project using Paypal") | ||
[![BitCoin donate button](http://img.shields.io/bitcoin/donate.png?color=yellow)](https://coinbase.com/checkouts/9ef59f5479eec1d97d63382c9ebcb93a "Donate once-off to this project using BitCoin") | ||
@@ -157,6 +157,6 @@ ### Contributors | ||
- Benjamin Lupton <b@lupton.cc> (https://github.com/balupton) - [view contributions](https://github.com/bevry/event-emitter-grouped/commits?author=balupton) | ||
- sfrdmn (https://github.com/sfrdmn) - [view contributions](https://github.com/bevry/event-emitter-grouped/commits?author=sfrdmn) | ||
- [Benjamin Lupton](https://github.com/balupton) <b@lupton.cc> — [view contributions](https://github.com/bevry/event-emitter-grouped/commits?author=balupton) | ||
- [sfrdmn](https://github.com/sfrdmn) — [view contributions](https://github.com/bevry/event-emitter-grouped/commits?author=sfrdmn) | ||
[Become a contributor!](https://github.com/bevry/event-emitter-grouped/blob/master/Contributing.md#files) | ||
[Become a contributor!](https://github.com/bevry/event-emitter-grouped/blob/master/CONTRIBUTING.md#files) | ||
@@ -163,0 +163,0 @@ <!-- /BACKERS --> |
Sorry, the diff of this file is not supported yet
126
14589
6
Updatedtaskgroup@~3.3.7