Last active
December 19, 2015 14:55
-
-
Save dtothefp/7af0ace1e4486ac46266 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const fromSpawn = spawn(function *() { | |
| let rejValFirst, rejValSecond, resValLast; | |
| try { | |
| rejValFirst = yield new Promise((res, rej) => { | |
| setTimeout(rej.bind(null, 'blaaa...first rejected!!!'), 1000); | |
| }); | |
| } catch (err) { | |
| console.error('Inside spawn error', err); | |
| } | |
| try { | |
| rejValSecond = yield new Promise((res, rej) => { | |
| setTimeout(rej.bind(null, 'blaaa...second rejected!!!'), 1000); | |
| }); | |
| } catch (err) { | |
| console.error('Inside spawn error', err); | |
| } | |
| try { | |
| resValLast = yield new Promise((res, rej) => { | |
| setTimeout(res.bind(null, 'yehhhh...last resolved!!!'), 1000); | |
| }); | |
| } catch (err) { | |
| console.error('Inside spawn error', err); | |
| } | |
| console.log('End of spawn', rejValFirst, rejValSecond, resValLast); | |
| return 'BLAAAHHHHH'; | |
| }); | |
| fromSpawn.then((data) => { | |
| console.log('Data from spawn', data); | |
| }).catch((err) => { | |
| console.error('Err from spawn', err.message); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment