effector 20.17.2
·
3644 commits
to master
since this release
- Add effects created via
attachto domain effects, allowing these effects to be called within other effects when usingfork
import {createDomain, attach} from 'effector'
import {fork, allSettled} from 'effector/fork'
const app = createDomain()
const add = app.createEffect({handler: _ => _})
const count = app.createStore(2).on(add.doneData, (x, y) => x + y)
const addWithCurrent = attach({
source: count,
effect: add,
mapParams: (params, current) => params + current,
})
const start = app.createEffect({
async handler(val) {
await addWithCurrent(val)
},
})
const scope = fork(app)
await allSettled(start, {
scope,
params: 3,
})
console.log(scope.getState(count))
// => 7