Skip to content

Instantly share code, notes, and snippets.

@dtothefp
Created December 7, 2015 18:27
Show Gist options
  • Save dtothefp/0e7a76b97cfaba5a9bbd to your computer and use it in GitHub Desktop.
Save dtothefp/0e7a76b97cfaba5a9bbd to your computer and use it in GitHub Desktop.
const fromSpawn = spawn(function *() {
const someVal = yield new Promise((res, rej) => {
setTimeout(res.bind(null, 'whatevs!!!'), 5000);
});
console.log(someVal);
return `I decided to return => ${someVal}`;
});
fromSpawn.then((data) => {
console.log('Data from spawn', data);
}).catch((err) => {
console.error('Err from spawn', err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment