-
-
Save siliconsocket/0cb29135f56ee2a856bf4e68e958466d to your computer and use it in GitHub Desktop.
Flexible example of Meteor.wrapAsync
This file contains hidden or 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
| // Thanks @trusktr | |
| var requestSync = Meteor.wrapAsync(function(url, callback) { | |
| request(url, function(error, response, body) { | |
| callback(error, {response: response, body: body}) | |
| }) | |
| }); | |
| var result = requestSync("http://google.com"); | |
| console.log(result.response, result.body); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment