when.js and generators

27 views
Skip to first unread message

Peter Mucha

unread,
Jan 8, 2014, 7:56:10 AM1/8/14
to cuj...@googlegroups.com
i am currently using when.js in several projects and i like to stay there. but currently, i am moving forward to use generators + promises (like described at Q's documentation). will there be any support for this in when.js?

Brian Cavalier

unread,
Jan 8, 2014, 8:14:26 AM1/8/14
to cuj...@googlegroups.com
Hey Peter,

I actually have an open pull request for this feature: https://github.com/cujojs/when/pull/206

If you're willing to give it a spin, I'll merge it to the dev branch asap, so you can try it out.  It's similar to the existing when/function module: it includes both a "lift" function that transforms a generator into a promise-returning coroutine, and "call/apply" for immediately executing a generator as a coroutine (returning a promise for the ultimate result).  Do those features cover what you need?  If not, let me know and I'll be happy to discuss others that you might need.

Peter Mucha

unread,
Jan 8, 2014, 10:04:35 AM1/8/14
to cuj...@googlegroups.com
sounds great, i would really like to try this out. the code looks like it fits my needs (especially the throw-support).

Brian Cavalier

unread,
Jan 8, 2014, 10:50:13 AM1/8/14
to cuj...@googlegroups.com
Cool. I just rebased the es6-generators branch onto latest dev and pushed it: https://github.com/cujojs/when/tree/es6-generators

Give it a go and let me know how it works for you.  It'd probably also be good to move the discussion over the to pull request--I'd love to capture your feedback there, as well as any problems you find so I can fix them as part of the pull request.


Thanks!
Reply all
Reply to author
Forward
0 new messages