Skip to content

Instantly share code, notes, and snippets.

@KasaiMagi
Last active August 29, 2015 14:18
Show Gist options
  • Save KasaiMagi/8010701922f0bb0743a8 to your computer and use it in GitHub Desktop.
Save KasaiMagi/8010701922f0bb0743a8 to your computer and use it in GitHub Desktop.
function foo(x, y) {
ajax(
"http://some.url/?x=" + x + "&y=" + y,
function(err, data) {
if (err) {
it.throw(err);
} else {
it.next(data);
}
}
);
}
function* main() {
try {
var text =
yield foo(11, 31);
console.log(text);
} catch (err) {
console.error(err);
}
}
var it = main();
it.next();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment