Skip to content

Instantly share code, notes, and snippets.

@ralphtheninja
Created December 2, 2014 16:35
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 ralphtheninja/c003f2592eeb7ceaa869 to your computer and use it in GitHub Desktop.
Save ralphtheninja/c003f2592eeb7ceaa869 to your computer and use it in GitHub Desktop.
function synchCallback(opts, cb) {
if (!opts.someImportantProperty) return cb(new Error('Missing important property'))
doSomeStuff(opts, function(err, result) {
console.log(err, result)
// ..
cb(err, result)
})
}
synchCallback({}, function(err, results) {
// this callback will be called here, before '*'
})
// '*'
console.log('this will be called after the callback above')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment