Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

takeEvery の修正 #6

Open
mitsuharu opened this issue Aug 10, 2023 · 0 comments
Open

takeEvery の修正 #6

mitsuharu opened this issue Aug 10, 2023 · 0 comments

Comments

@mitsuharu
Copy link
Owner

mitsuharu commented Aug 10, 2023

call を fork に入れ替える

func takeEvery( _ actionType: SagaAction.Type, saga: @escaping Saga<Any>) {
    Task.detached {
        while true {
            let action = await take(actionType)
            await call(saga, action) // <-  takeEvery ではここを待つ必要がない、実質 takeLeading になっている
        }
    }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant