Skip to content

Instantly share code, notes, and snippets.

@athlan
Last active August 29, 2015 14:06
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 athlan/bcf18e29f2a9afc420bd to your computer and use it in GitHub Desktop.
Save athlan/bcf18e29f2a9afc420bd to your computer and use it in GitHub Desktop.
Nodejs Unused callback
var async = require('async')
var counter = 0
async.series([
function(callback) {
async.whilst(
function() { return counter < 5; },
function(whilstCallback) {
console.log('tick %d', counter)
++counter
if(counter == 3)
return callback();
setTimeout(whilstCallback, 1000)
},
function() {
console.log('counter %d', counter)
}
)
}
], function() {
console.log('series done')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment