wow, logic fail

if you called the same event twice, it will reduce count anyways (so I
could have event.any(a,b,c) and call a three times and it would
complete.
This commit is contained in:
psychobunny
2014-10-04 16:11:36 -04:00
parent 27c214486b
commit edf37f3e0c

View File

@@ -6,7 +6,9 @@ var eventEmitter = new (require('events')).EventEmitter();
eventEmitter.all = function(events, callback) {
function onEvent(event) {
eventEmitter.on(events[event], function() {
if (events.indexOf(event) !== -1) {
events.splice(events.indexOf(event), 1);
}
if (events.length === 0) {
callback();