TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

RQ – A small JavaScript library for managing asychronicity

109 pointsby andrijacabout 10 years ago

9 comments

hamburglarabout 10 years ago
I think I must be missing something, because this looks to me like a less-elegant reinvention of the functionality of a handful of already extant promise libraries. A library like 'when' already does all of this, and is much more composable. As an obvious example, there is no reason to clutter up your interfaces with specialized things like timeout parameters when a timeout something you can transparently wrap on any promise without changing its interface one bit.
评论 #9372000 未加载
kondroabout 10 years ago
People keep comparing this to Bluebird, which is great and all, but Bluebird&#x27;s JS is 72KB minified, whereas this library is just 3KB.<p>That&#x27;s what makes this a &quot;small&quot; JavaScript library for managing asynchronicity. And when you&#x27;re using it for things like choosing which ads to display, etc (like some of the examples) you really don&#x27;t want your JS load overhead to be very high.
评论 #9373227 未加载
latchkeyabout 10 years ago
Looking at the commit log [1], this code started in May 2013. That might explain why you might be thinking - why not async|bluebird|Promises? It looks like bluebird didn&#x27;t start until Sept 2013 [2].<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;douglascrockford&#x2F;RQ&#x2F;commits&#x2F;master" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;douglascrockford&#x2F;RQ&#x2F;commits&#x2F;master</a> [2] <a href="https:&#x2F;&#x2F;github.com&#x2F;petkaantonov&#x2F;bluebird&#x2F;commits&#x2F;master?page=42" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;petkaantonov&#x2F;bluebird&#x2F;commits&#x2F;master?page...</a>
评论 #9372852 未加载
tejohnsoabout 10 years ago
Looks interesting but some direct comparisons to es6 promises would really help.<p>Favourite function description quote: &quot;RQ.parallel does not add parallelism to JavaScript. It allows JavaScript programs to effectively exploit the inherent parallelism of the universe.&quot;<p>Favourite variable name: untilliseconds
评论 #9372715 未加载
Cianticabout 10 years ago
Must be frustrating for Crockford to be in TC39.<p>He didn&#x27;t like class keyword, thought typing (TypeScript etc) is a wrong direction. This (albeit it began 2013, but it was just updated) library does not mention ES6 Promises, proposal for async await, or the yield hack.
评论 #9376345 未加载
评论 #9372905 未加载
UserRightsabout 10 years ago
There is also <a href="https:&#x2F;&#x2F;github.com&#x2F;mbostock&#x2F;queue" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mbostock&#x2F;queue</a> 415 bytes minified and gzipped!
outside1234about 10 years ago
errr. require(&#x27;async&#x27;)?
评论 #9372668 未加载
评论 #9372333 未加载
评论 #9373291 未加载
ameliusabout 10 years ago
It is kind of nasty to break your code into basic blocks, and tie them using library functions. This will certainly not make things much cleaner!<p>I was hoping one day Javascript could support &quot;deep&quot; coroutines, so we can keep on programming &quot;sequentially&quot; as we did before while still using asynchronous mechanisms.<p>Perhaps there exist languages that compile to Javascript, that offer deep coroutines (?)
评论 #9374663 未加载
评论 #9374213 未加载
thomasfoster96about 10 years ago
I&#x27;m not sure I&#x27;ll start using RQ all the time over Promises, but this does offer two nice features that Promises don&#x27;t: optionals and timeouts. Optionals could easily be implemented as some like Promise.some(), while Promise.[all|some|race]() could all start taking an optional timeout parameter.
评论 #9371908 未加载
评论 #9371835 未加载
评论 #9372310 未加载
评论 #9372080 未加载