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.

Effection 3.0 – Structured Concurrency and Effects for JavaScript

6 pointsby cowboydover 1 year ago

2 comments

qudatover 1 year ago
`redux-saga` maintainer here.<p>I&#x27;ve been using `effection` to build a replacement for `redux-saga` over at <a href="https:&#x2F;&#x2F;github.com&#x2F;neurosnap&#x2F;starfx">https:&#x2F;&#x2F;github.com&#x2F;neurosnap&#x2F;starfx</a><p>Effection has demonstrated to me how truly powerful delimited continuations are and why structured concurrency is an incredible asset for anything that requires async flow control -- basically everything in TS&#x2F;JS.<p>I know sometimes it&#x27;s hard to imagine why someone would need structured concurrency or care about delimited continuations for a front-end application, but this is a game changer in terms of expressing async flow control.<p>Some things to note about Effection:<p>- API surface area is small <a href="https:&#x2F;&#x2F;github.com&#x2F;thefrontside&#x2F;effection&#x2F;issues&#x2F;851">https:&#x2F;&#x2F;github.com&#x2F;thefrontside&#x2F;effection&#x2F;issues&#x2F;851</a><p>- It tries to stay as close to JS constructs as possible so it will feel very familiar<p>- Resource cleanup is automatic (when a function passes out of scope all descendent tasks are shut down automatically)<p>- End-user doesn&#x27;t need to think about delimited continuations<p>The only leap users need to learn coming from async&#x2F;await is the syntax.<p><pre><code> import { main, call } from &quot;effection&quot;; await main(function*() { const response = yield* call(fetch(&quot;my-api.com&quot;)); const data = yield* call(response.json); }); </code></pre> In this way, effection is very approachable and I highly recommend people try it out.
tarasmover 1 year ago
Here is an example of using Effection with React to build a sophisticated loader <a href="https:&#x2F;&#x2F;github.com&#x2F;taras&#x2F;effection-react-loadingspinner">https:&#x2F;&#x2F;github.com&#x2F;taras&#x2F;effection-react-loadingspinner</a>