Skip to content

Instantly share code, notes, and snippets.

@darkowlzz
Created December 3, 2014 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darkowlzz/cca53999b5fee4e9fb2a to your computer and use it in GitHub Desktop.
Save darkowlzz/cca53999b5fee4e9fb2a to your computer and use it in GitHub Desktop.
Callback based connectAll
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