Skip to content

Instantly share code, notes, and snippets.

@chapel
Last active December 22, 2015 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chapel/6515933 to your computer and use it in GitHub Desktop.
Save chapel/6515933 to your computer and use it in GitHub Desktop.
var fn = function* (args) {
yield asyncFn(args);
};
Object.defineProperty(this, 'fn', {
get: function () {
return function () {
return fn.next();
}
}
});
var value = fn(1);
function autoGen(fn) {
return function () {
return fn.next();
}
}
var fn = autoGen(function* (args) {
yield asyncFn(args);
};
var value = fn(1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment