Skip to content

Instantly share code, notes, and snippets.

@chrismatheson
Created June 8, 2012 11:04
Show Gist options
  • Save chrismatheson/2895004 to your computer and use it in GitHub Desktop.
Save chrismatheson/2895004 to your computer and use it in GitHub Desktop.
callbacks in loops
var processQueue = function(data) {
if(typeof data === 'undefined'){
//start of queue
data = new Object({});
}
util.isError(data){
console.error('error sending msg');
console.error(util.inspect(data));
//process.exit(1);
}else{
// no data = start of queue so dont need to check respose data
if (messageQueue.length) {
// Bloody rate limit
twit.newDirectMessage(currentUserID, messageQueue.shift(), processQueue);
//console.log('now there are ' + messageQueue.length + ' messages left');
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment