Created
February 3, 2016 14:29
-
-
Save domachine/3592b932832107f623c1 to your computer and use it in GitHub Desktop.
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
'use strict'; | |
const io = require('run-io'); | |
function performingIO(done) { | |
console.log('Heay IO ...'); | |
setTimeout(() => done(42), 1000); | |
} | |
function *myGenerator() { | |
const a = yield io.lift(performingIO)(); | |
return a; | |
} | |
run(myGenerator, done)(); | |
function done(err, value) { | |
// Check `err` for exceptions thrown in the generator | |
// `value` is the return value of the generator | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment