From 5ac788565fa28ddc05c4126ad4b09bcb87271950 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Wed, 4 Jun 2014 15:57:00 -0400 Subject: [PATCH] eventEmitter.any --- src/emitter.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/emitter.js b/src/emitter.js index 93e212c05b..a2f68e3324 100644 --- a/src/emitter.js +++ b/src/emitter.js @@ -20,4 +20,20 @@ eventEmitter.all = function(events, callback) { } }; +eventEmitter.any = function(events, callback) { + for (var ev in events) { + if (events.hasOwnProperty(ev)) { + (function(ev) { + eventEmitter.on(events[ev], function() { + if (events !== null) { + callback(); + } + + events = null; + }); + }(ev)); + } + } +}; + module.exports = eventEmitter; \ No newline at end of file