Skip to content

Instantly share code, notes, and snippets.

@siliconsocket
Forked from rclai/meteor-wrapAsync.js
Created May 5, 2020 00:38
Show Gist options
  • Select an option

  • Save siliconsocket/0cb29135f56ee2a856bf4e68e958466d to your computer and use it in GitHub Desktop.

Select an option

Save siliconsocket/0cb29135f56ee2a856bf4e68e958466d to your computer and use it in GitHub Desktop.
Flexible example of Meteor.wrapAsync
// 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