Skip to content

Instantly share code, notes, and snippets.

@domachine
Created February 3, 2016 14:29
Show Gist options
  • Save domachine/3592b932832107f623c1 to your computer and use it in GitHub Desktop.
Save domachine/3592b932832107f623c1 to your computer and use it in GitHub Desktop.
'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