Created
December 3, 2014 11:25
-
-
Save darkowlzz/cca53999b5fee4e9fb2a to your computer and use it in GitHub Desktop.
Callback based connectAll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bot.prototype.connectAll = function (callback) { | |
var that = this; | |
that.client.connect(5, function (input) { | |
that.channels.forEach(function (channel, index, channels) { | |
that.client.join(channel, function (input) { | |
if (index === (channels.length - 1)) { | |
if (!! callback) | |
callback(); | |
} | |
}); | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment