-
-
Save laser/7664244 to your computer and use it in GitHub Desktop.
ES6 Generators
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
sync(function* (resume) { | |
try (e) { | |
yield setTimeout(resume, 1000); | |
var greeting = yield _get('/something.ajax?greeting', resume) | |
var who = yield _get('/else.ajax?who&greeting=' + greeting, resume) | |
console.log(greeting + ' ' + who) | |
} | |
catch (e) { | |
console.log(e); | |
throw e; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment