How to use the redux-saga.delay function in redux-saga

To help you get started, we’ve selected a few redux-saga examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github neos / neos-ui / packages / neos-ui-sagas / src / UI / ContentCanvas / index.js View on Github external
// We need to delay, so that the iframe gets cleared before we load a new src
            //
            yield delay(0);
            yield put(actions.UI.ContentCanvas.setSrc(nextAction.payload.src || src));
            continue;
        }

        if (nextAction.type === actionTypes.UI.ContentCanvas.REQUEST_LOGIN) {
            yield put(actions.System.authenticationTimeout());
            yield take(actionTypes.System.REAUTHENTICATION_SUCCEEDED);

            //
            // We need to delay, so that the iframe gets cleared before we load a new src
            //
            yield put(actions.UI.ContentCanvas.setSrc(''));
            yield delay(0);
            yield put(actions.UI.ContentCanvas.setSrc(src));
            continue;
        }
    }
}
github zxj963577494 / OverWatchTeams-React-Native-Expo / src / sagas / userSaga.js View on Github external
function* putUserInfoWorker(payload) {
  try {
    Toast.loading('提交中')
    const response = yield call(userService.putUserInfo, payload)
    yield put(action.putUserInfoSuccess(response))
    Toast.success('提交成功', 1.5)
    yield delay(1500)
    yield put(NavigationActions.back())
  } catch (error) {
    yield put(action.putUserInfoFailed(error))
    Toast.fail('提交失败', 1.5)
  }
}
github BCNetio / BlockStackWallet / app / Wallets / WalletList / Saga.js View on Github external
function* fetchWalletInfo(action) {
  let walletInfo;
  try {
    walletInfo = yield call(xhr.get, action.payload);
  } catch (e) {
    yield delay(5000);
    yield put(action);
  }
  yield put({ type: types.MOUNT_WALLET_INFO, payload: walletInfo.data });
}
github zxj963577494 / OverWatchTeams / src / sagas / warOrderSaga.js View on Github external
function* postWarOrderWorker(payload) {
  try {
    yield put(action.fetchRequest({ text: '提交中' }))
    const count = yield call(warOrderService.getWarOrderCountOfToday)
    const userinfo = yield call(userService.getUserInfoToJson)
    const warOrderLimit = userinfo.warOrderLimit
    if (count <= warOrderLimit) {
      const team = yield call(teamsService.getTeamToJson, payload)
      const response = yield call(warOrderService.cerateWarOrder, payload, team)
      yield put(action.fetchSuccess())
      yield put(action.postWarOrderSuccess(response))
      Toast.success('提交成功', 1)
      yield delay(1000)
      yield put(goBack())
    } else {
      yield put(action.postWarOrderFailed())
      yield put(action.fetchFailed())
      Toast.success(`1天最多发布${warOrderLimit}条比赛约战帖`, 2)
      yield delay(2000)
      yield put(goBack())
    }
  } catch (error) {
    yield put(action.postWarOrderFailed(error))
    yield put(action.fetchFailed())
    Toast.success('提交失败', 1)
  }
}
github zxj963577494 / OverWatchTeams / src / sagas / warOrderSaga.js View on Github external
const count = yield call(warOrderService.getWarOrderCountOfToday)
    const userinfo = yield call(userService.getUserInfoToJson)
    const warOrderLimit = userinfo.warOrderLimit
    if (count <= warOrderLimit) {
      const team = yield call(teamsService.getTeamToJson, payload)
      const response = yield call(warOrderService.cerateWarOrder, payload, team)
      yield put(action.fetchSuccess())
      yield put(action.postWarOrderSuccess(response))
      Toast.success('提交成功', 1)
      yield delay(1000)
      yield put(goBack())
    } else {
      yield put(action.postWarOrderFailed())
      yield put(action.fetchFailed())
      Toast.success(`1天最多发布${warOrderLimit}条比赛约战帖`, 2)
      yield delay(2000)
      yield put(goBack())
    }
  } catch (error) {
    yield put(action.postWarOrderFailed(error))
    yield put(action.fetchFailed())
    Toast.success('提交失败', 1)
  }
}
github hapood / redux-arena / example / reduxBundleA / saga.js View on Github external
function* dynamicState() {
  while (true) {
    yield delay(500);
    yield* setSceneState({ dynamicState: Math.floor(Math.random() * 100) });
  }
}