mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 16:05:49 +01:00
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:
@@ -6,7 +6,9 @@ var eventEmitter = new (require('events')).EventEmitter();
|
|||||||
eventEmitter.all = function(events, callback) {
|
eventEmitter.all = function(events, callback) {
|
||||||
function onEvent(event) {
|
function onEvent(event) {
|
||||||
eventEmitter.on(events[event], function() {
|
eventEmitter.on(events[event], function() {
|
||||||
events.splice(events.indexOf(event), 1);
|
if (events.indexOf(event) !== -1) {
|
||||||
|
events.splice(events.indexOf(event), 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (events.length === 0) {
|
if (events.length === 0) {
|
||||||
callback();
|
callback();
|
||||||
|
|||||||
Reference in New Issue
Block a user