tj/co
View on GitHub ↗ ★ 11,823 JavaScript
The ultimate generator based flow-control goodness for nodejs (supports thunks, promises, etc)
37 mentions on Hacker News by 33 people: 2 stories, 35 comments · first 2013-06-06 · latest 2024-01-05
20082026
-
…[2]: https://v8.dev/blog/fast-async#await-under-the-hood [3]: https://github.com/tj/co [4]: https://redux-saga.js.org
comment by rixtox · 2024-01-05 · in Main-Thread-Scheduling -
…app.use(async (ctx, next) => { try { await next() } catch (error) { // handle errors } }) [0] https://github.com/tj/co
comment by TheAceOfHearts · 2019-03-05 · in Node.js Logging Made Right -
CO https://github.com/tj/co in popularized this technique a few years ago. It implements something similar to the function you present here. Babel actually transforms async/await to generators ( https://babeljs.io/docs/en/babel-plugin-trans…
comment by asprouse · 2018-10-10 · in Implementing Async and Await with Generators -
…https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... 2. https://github.com/mozilla/task.js https://github.com/tj/co http://bluebirdjs.com/docs/api/promise.coroutine.html
comment by tlrobinson · 2018-08-08 · in The magic of asyncio explained -
…painful with.js Node 1-2yrs back when Promises and coroutines started picking up steam [such as https://github.com/tj/co ]. It was always a shot in the dark. Has this situation changed now? (basically is the stdlib all async friendly now?)
comment by dmix · 2017-07-26 · in Why I’m Learning Perl 6 -
…It builds on top of promises and generators, and isn't very hard to understand under the hood. See https://github.com/tj/co . I wouldn't recommend it, but it might be something to play with because ... 4. ... async/await is coming to…
comment by GeneralMaximus · 2017-02-03 · in Node v7.5.0 Released -
I'm not trying to be antagonistic, but I am honestly curious how this differentiates from tj/co? https://github.com/tj/co
comment by jamesroseman · 2016-06-02 · in Async and Await -
…- objects (parallel execution) - generators (delegation) - generator functions (delegation) (see https://github.com/tj/co#yieldables ) Have your library the same support?
comment by julbaxter · 2016-05-17 · in I reimplemented tj/co in 15 lines of code -
…something like (untyped) scoped continuations [4]. [1] https://maxtaco.github.io/coffee-script/ [2] https://github.com/tj/co [3] http://masnun.com/2015/11/11/using-es7-asyncawait-today-with... [4] http://blog.paralleluniverse.co/2015/08/07/…
comment by acjohnson55 · 2015-12-27 · in Pogoscript – a compile-to-JS language that emphasises concurrency, readability -
…co, galaxy, or gen-run? [1]: https://github.com/ubolonton/js-csp [2]: http://taskjs.org/ [3]: https://github.com/tj/co [4]: https://github.com/bjouhier/galaxy [5]: https://github.com/creationix/gen-run
comment by iso8859-1 · 2015-10-02 · in Microsoft Edge gets native ECMAScript 7 async/await support in latest build -
Pretty much, yeah: https://github.com/tj/co
comment by spion · 2015-10-01 · in Trying Rust for web services -
Using abstractions like http://koajs.com/ and https://github.com/tj/co make Node code feel like every other language. var user; try { user = yield db.insertUser('foo') } catch(err) { if (err.code === '23505') { this.flash['error'] =…
comment by danneu · 2015-09-08 · in Node v4.0.0 -
…with generators yields code very similar to async/await, without relying on experimental features. https://github.com/tj/co or https://github.com/petkaantonov/bluebird/blob/master/API.md#...
comment by voxtex · 2015-05-10 · in Syncify.js – Eliminates the need for callbacks in the browser -
…building coroutine functions with generators? The "co" library (and probably some others) do this. https://github.com/tj/co It seems mostly like a syntactical difference to me - with coroutines you "yield" instead of "await." You can still…
comment by BFay · 2015-03-10 · in Taming the asynchronous beast with ES7 -
…[3] that are able to handle nice async syntaxes. [1]: https://iojs.org/ [2]: http://koajs.com/ [3]: https://github.com/tj/co
comment by robinricard · 2015-01-28 · in Node.js Flow – Callback Hell vs. Async vs. Highland Streams -
…Bluebird.coroutine() ( https://github.com/petkaantonov/bluebird/blob/master/API.md#... ) or co ( https://github.com/tj/co , see also https://github.com/koajs/koa )
comment by drapper · 2015-01-28 · in Node.js Flow – Callback Hell vs. Async vs. Highland Streams -
…set of objects. > I believe that flow control in the future will be done with generators; check out https://github.com/visionmedia/co for example. Generators and promises are both types of flow control that will be used in the future:…
comment by reissbaker · 2014-05-29 · in Zones – Robust error handling and flow control for Node.js -
…cleaned up. I believe that flow control in the future will be done with generators; check out https://github.com/visionmedia/co for example.
comment by piscisaureus · 2014-05-29 · in Zones – Robust error handling and flow control for Node.js -
…they should check out TypeScript. Works great with node. [1] https://github.com/jmar777/suspend [2] https://github.com/visionmedia/co [3] https://github.com/CrabDude/trycatch
comment by codystebbins · 2014-05-13 · in Why Node.js is becoming the go-to technology in the Enterprise -
…res1); console.log('async2:', res2); console.log('async3:', res3); }); With the co library ( https://github.com/visionmedia/co ), it'd look like this: co(function*() { var results = yield [async1, async2, async3]; console.log('async1:',…
comment by jclem · 2014-04-25 · in Better JavaScript Promises -
…libraries, which means increased payload and incompatibilities among frameworks. Check out co ( https://github.com/visionmedia/co/blob/master/index.js ). For all its features it's tiny. Increased payload and incompatibility is a blanket…
comment by jeswin · 2014-04-25 · in Better JavaScript Promises -
have you tried Co ( https://github.com/visionmedia/co ) and if so what's your experience?
comment by alexgorbatchev · 2014-04-16 · in Comparing Node.js Promises, Try/Catch, Angular Zone.js and Zone -
> Seems you have misunderstood how it works. https://github.com/visionmedia/co/blob/master/index.js No. > Typically in apps using 'co', functions will return generators, not promises. Promises were probably added because of all the…
comment by masklinn · 2014-03-15 · in An open question (rant) about Node.js -
Seems you have misunderstood how it works. https://github.com/visionmedia/co/blob/master/index.js Typically in apps using 'co', functions will return generators, not promises. Promises were probably added because of all the existing code…
comment by jeswin · 2014-03-14 · in An open question (rant) about Node.js -
Actually, it's not promises. It's generators. co thunkifies promises: https://github.com/visionmedia/co/blob/master/index.js#L209-...
comment by sync · 2014-03-14 · in An open question (rant) about Node.js -
…that is truly write-once, run-anywhere. A significant advantage in favor of node. [1] https://github.com/visionmedia/co
comment by jeswin · 2014-03-14 · in An open question (rant) about Node.js -
…Generators, which are available now in node v0.11. Here's both a series and a waterfall example: https://github.com/visionmedia/co#example
comment by sync · 2014-03-14 · in An open question (rant) about Node.js -
https://github.com/visionmedia/co
comment by wcummings · 2014-03-13 · in Sane Concurrency with Go -
Generators actually solve the callback issue: https://github.com/visionmedia/co
comment by eknkc · 2014-01-29 · in Paving the way for the new Node.js -
Not an article, but this is a good library that uses generator functions without promises: https://github.com/visionmedia/co
comment by Touche · 2013-11-07 · in What does `return function *(){…}` mean in JavaScript? -
…libraries will be reusable with generators via e.g. https://github.com/jmar777/suspend or https://github.com/visionmedia/co etc. Performance could also potentially improve as in V8 closures are much more expensive than generators.
comment by spion · 2013-10-22 · in Explicit bootstrapping of pip in Python installations -
…is improving (such as ECMAScript 6 including yield/generators which will allow things like this https://github.com/visionmedia/co ) which should reduce the callback hell situation. Besides popularity and momentum, the language and runtimes…
comment by cpprototypes · 2013-10-07 · in Why the Tech Industry Needs to Deal With Its Ageism Problem -
…in the next node stable via `node --harmony-generators`. Here's an example for those interested: https://github.com/visionmedia/co
comment by chrisohara · 2013-08-23 · in Wait.for: Sequential programming for Node.js (beta) -
…require any changes to the underlying libraries and gives you a much nicer syntax to work with. See https://github.com/visionmedia/co
comment by nadaviv · 2013-08-13 · in The Future of Programming in Node.js