Hacker GitHub

← All repos

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

Mentions per year 37 mentions · busiest year 2014 (14)
20082026
  1. …[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
  2. …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
  3. 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…
  4. …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
  5. …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
  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
  7. 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
  8. …- 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
  9. …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/…
  10. …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
  11. Pretty much, yeah: https://github.com/tj/co
    comment by spion · 2015-10-01 · in Trying Rust for web services
  12. 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
  13. …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#...
  14. …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…
  15. …[3] that are able to handle nice async syntaxes. [1]: https://iojs.org/ [2]: http://koajs.com/ [3]: https://github.com/tj/co
  16. …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 )
  17. …as JS is, generators make possible some pretty interesting stuff[1] that I would miss in Dart. [1] https://github.com/visionmedia/co
    comment by _greim_ · 2014-06-27 · in Dart 1.5
  18. …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:…
  19. …cleaned up. I believe that flow control in the future will be done with generators; check out https://github.com/visionmedia/co for example.
  20. …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
  21. …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
  22. …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
  23. have you tried Co ( https://github.com/visionmedia/co ) and if so what's your experience?
  24. > 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
  25. 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
  26. Actually, it's not promises. It's generators. co thunkifies promises: https://github.com/visionmedia/co/blob/master/index.js#L209-...
  27. …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
  28. …Generators, which are available now in node v0.11. Here's both a series and a waterfall example: https://github.com/visionmedia/co#example
  29. https://github.com/visionmedia/co
    comment by wcummings · 2014-03-13 · in Sane Concurrency with Go
  30. 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
  31. Not an article, but this is a good library that uses generator functions without promises: https://github.com/visionmedia/co
  32. …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.
  33. …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…
  34. …in the next node stable via `node --harmony-generators`. Here's an example for those interested: https://github.com/visionmedia/co
  35. …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
  36. ▲ 2
    Co
    story by MatthewPhillips · 2013-06-07 · 1 comment
  37. ▲ 2
    Async flow control in node.js using Harmony generators
    story by jb55 · 2013-06-06 · 0 comments