-
-
Save LincolnBurrows/193f7cb2e8adf508613703250c60d323 to your computer and use it in GitHub Desktop.
thunkify&co&yield sample
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 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