domenic at domenicdenicola.com (2014-01-29T15:57:24.080Z)
Andrea Giammarchi wrote:
> arguments.callee.caller would have done that </trolling>
> </but-actually-not-so-much>
No, Bradley wants the generator-iterator (what ES6 draft calls a
Generator), not the generator function (GeneratorFunction). Any .callee
would have to be a function, so a GeneratorFunction.
But the gist'ed example won't work:
function* doLogin_() {
try {
/* START ASYNC TRANSPILE */
login(req).then(function (session) {
gen.next(session);
You can't next an active generator.
Instead, the trick is to avoid promises inside the generator function.
Put them "on the outside" (and "backstage") as task.js does.
http://taskjs.org/.
Andrea Giammarchi wrote: > arguments.callee.caller would have done that </trolling> > </but-actually-not-so-much> No, Bradley wants the generator-iterator (what ES6 draft calls a Generator), not the generator function (GeneratorFunction). Any .callee would have to be a function, so a GeneratorFunction. But the gist'ed example won't work: function* doLogin_() { try { /* START ASYNC TRANSPILE */ login(req).then(function (session) { gen.next(session); You can't next an active generator. Instead, the trick is to avoid promises inside the generator function. Put them "on the outside" (and "backstage") as task.js does. http://taskjs.org/. /be