Structured Concurrency Patterns for JavaScript #4
oleksii-shepel
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
streamix 2.0.46: Big Changes in @epikodelabs/streamix/coroutines
The coroutines package grew up.
Instead of one fuzzy cluster of worker tools, it now has three clear jobs:
coroutine(...)for one dedicated worker and queued taskscompute(...)for worker-pool throughputactor(...)for long-lived stateful workers with messagingThat split is the whole story. The package is simpler because each tool now has a cleaner lane.
Why It Feels Better
coroutine(...)is now the straightforward "do this work off the main thread" tool.compute(...)is the "give me parallel throughput" tool.actor(...)is the new "this worker behaves like a little service" tool.If your worker has state, sends events, makes requests, or stays alive on purpose, it probably wants to be an actor.
One Nice Cleanup
The main-thread API is centered on
main:That is easier to teach and easier to read.
main.inbox.subscribe(...)is also now just one subscribe form. If you only want messages addressed to the main thread, filter inside the handler:In Practice
coroutine(...).compute(...).actor(...).That is the new shape of the package, and it is much nicer.
Read More
Beta Was this translation helpful? Give feedback.
All reactions