Last active
August 29, 2015 13:57
-
-
Save dmcaulay/9790417 to your computer and use it in GitHub Desktop.
node.js callbacks
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
var asyncFunction = function(arg, callback) { | |
anotherAsync(function(err, res) { | |
if (err) return callback(err); | |
var returnValue = res + 1; | |
callback(null, returnValue); | |
}); | |
}; | |
var callbacks = require('asunder').split; | |
var asyncFunction = function(arg, callback) { | |
anotherAsync(callbacks(callback, function(res) { | |
var returnValue = res + 1; | |
callback(null, returnValue); | |
})); | |
}; | |
var asyncFunction = function(arg, callback) { | |
a.split(anotherAsync)(callback, function(res) { | |
var returnValue = res + 1; | |
callback(null, returnValue); | |
})); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment