2 ms·
Effection 3.0 – Structured Concurrency and Effects for JavaScript
- qudat 3y ago`redux-saga` maintainer here. I've been using `effection` to build a replacement for `redux-saga` over at https://github.com/neurosnap/starfx https://github.com/neurosnap/starfx 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/JS. I know sometimes it'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. Some things to note about Effection: - API surface area is small https://github.com/thefrontside/effection/issues/851 https://github.com/thefrontside/effection/issues/851 - It tries to stay as close to JS constructs as possible so it will feel very familiar - Resource cleanup is automatic (when a function passes out of scope all descendent tasks are shut down automatically) - End-user doesn't need to think about delimited continuations The only leap users need to learn coming from async/await is the syntax. import { main, call } from "effection"; await main(function*() { const response = yield* call(fetch("my-api.com")); const data = yield* call(response.json); }); In this way, effection is very approachable and I highly recommend people try it out.
- tarasm 3y agoHere is an example of using Effection with React to build a sophisticated loader https://github.com/taras/effection-react-loadingspinner https://github.com/taras/effection-react-loadingspinner