channel
ts-chan
channel | ts-chan | |
---|---|---|
1 | 6 | |
66 | 108 | |
- | - | |
0.0 | 8.1 | |
11 months ago | 6 months ago | |
JavaScript | TypeScript | |
Apache License 2.0 | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
channel
-
Show HN: Ts-Chan – Go-Like Concurrency Primitives for TypeScript/JavaScript
I think I prefer its more concise API, e.g. [for select](https://github.com/NodeGuy/channel/blob/main/API.md#examples). ts-chan's API looks a bit too verbose to my taste.
Here's an example from ts-chan:
```
ts-chan
-
Fan-in pattern in JavaScript, ts-chan docs, feedback requested
Hey HN,
Based on feedback on my last post: https://news.ycombinator.com/item?id=38156519
I've been working on better documentation and examples, aimed at JavaScript developers without significant knowledge of concurrency-related patterns.
The first pattern I've covered is "fan-in". Aside from a side-by-side comparison, in the pattern doc linked in the question, I also implemented an example of the pattern, a "log aggregator", which multiplexes (TCP) log streams, formatting and writing out lines to a file. Details in the example readme: https://github.com/joeycumines/ts-chan/blob/main/examples/pa...
I'd appreciate it if you could let me know what you think, and if this is a step in a helpful direction.
Thanks :)
-
Show HN: Ts-Chan – Go-Like Concurrency Primitives for TypeScript/JavaScript
Generators have lots of really nice uses, yep.
I'm not sure what specifically you were imagining, but I've added an example of how "vanilla JS" can achieve fan-in, using an AsyncGenerator: https://github.com/joeycumines/ts-chan/blob/main/docs/patter...
It uses one of the patterns suggested in a comment chain above, which I think is pretty neat, and wasn't one that readily occurred to me: https://news.ycombinator.com/item?id=38163562
I'm not making a case for using ts-chan for any situation where a simple generator-based solution suffices. I wouldn't call the example solution (in my first link) simple, but it's something I'd personally be ok with maintaining. Like, I'd approve a PR containing something similar without significant qualms, _if_ there was a significant enough motivator, and it was sufficiently unit tested. I might suggest that as an alternative, to make it easier to maintain, but wouldn't be particularly concerned either way.
That's all very subjective, though :)
What are some alternatives?
generator-ticker - An ES6 generator similar to setInterval that adjusts for slow receivers.
throat - Throttle a collection of promise returning functions
contextlib - JS implementation of python's context managers. With 💙 { ... }
nanothreads - A tiny multi-threading & concurrency library, for Node.js and the browser
p-map - Map over promises concurrently
sporadic - Composable Concurrency Abstractions for JavaScript. :railway_track: :rhinoceros: :train: :vertical_traffic_light: