如何在循环生成器中的每个映射中延迟?它的产量延迟工作1次。也许不应该是something.map
?
function* loop(param1, param2, param3) {
try {
const count = yield call(getCall, param1, param2)
yield delay(150)
return {
id: param2,
title: param3,
count: param1
}
} catch (e) {
console.log(e)
}
}
function* saga(action) {
try {
yield put(setIsLoadingAction(true))
const something = yield select(selectSomethig)
//loop here
const data = yield all(
something.map((someth) => loop(action.payload, someth.id, someth.title))
)
yield put(setSomething(data))
yield put(setIsLoadingAction(false))
} catch (e) {
console.log(e)
}
}