Skip to content

Instantly share code, notes, and snippets.

@LincolnBurrows
Created May 10, 2016 08:24
Show Gist options
  • Save LincolnBurrows/193f7cb2e8adf508613703250c60d323 to your computer and use it in GitHub Desktop.
Save LincolnBurrows/193f7cb2e8adf508613703250c60d323 to your computer and use it in GitHub Desktop.
thunkify&co&yield sample
var co = require('co');
var thunkify = require('thunkify');
function f1(callback){
callback(0, 1);
}
var n = thunkify(f1);
co(function* (){
var out = yield n();
//console.log(out);
return 2;
}).catch(function(err){
console.log('error');
})
.then(function(data){
console.log(data);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment