redux-saga/effects#fork TypeScript Examples
The following examples show how to use
redux-saga/effects#fork.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: saga.ts From react-js-tutorial with MIT License | 6 votes |
export function* loginSaga() {
yield fork(checkUserSession);
while (true) {
const action = yield take(actions.login.type);
yield* saveUserSession(action);
yield take(actions.logout.type);
yield* clearUserSession();
}
}
Example #2
Source File: updater.ts From marina with MIT License | 6 votes |
// starts a set of workers in order to handle asynchronously the UPDATE_TASK action
export function* watchUpdateTask(): SagaGenerator<void, UpdateTaskAction> {
const MAX_UPDATER_WORKERS = 3;
const accountToUpdateChan = yield* createChannel<UpdateTaskAction['payload']>();
for (let i = 0; i < MAX_UPDATER_WORKERS; i++) {
yield fork(updaterWorker, accountToUpdateChan);
}
// start the asset updater
const assetsChan = yield* createChannel<{ assetHash: string; network: NetworkString }>();
yield fork(assetsWorker, assetsChan);
yield fork(watchForAddUtxoAction, assetsChan); // this will fee the assets chan
// listen for UPDATE_TASK
while (true) {
const { payload } = yield take(UPDATE_TASK);
yield fork(updateUtxoAssets(assetsChan));
yield put(accountToUpdateChan, payload);
}
}
Example #3
Source File: user-saga.ts From Riakuto-StartingReact-ja3.1 with Apache License 2.0 | 5 votes |
export default function* userSaga() {
yield all([fork(watchGetMembers)]);
}
Example #4
Source File: index.ts From firebase-tools-ui with Apache License 2.0 | 5 votes |
export function* rootSaga() {
yield all([fork(authSaga)]);
}
Example #5
Source File: main.ts From marina with MIT License | 5 votes |
function* mainSaga(): SagaGenerator<void, void> {
yield fork(watchReset);
yield fork(watchUpdateTaxi);
yield fork(watchUpdateTask);
yield fork(updateAfterEachLoginAction);
yield fork(watchStartDeepRestorer);
}
Example #6
Source File: saga.ts From slice-machine with Apache License 2.0 | 5 votes |
// Single entry point to start all Sagas at once
export default function* rootSaga() {
yield fork(watchSimulatorSagas);
yield fork(watchAvailableCustomTypesSagas);
yield fork(watchSliceSagas);
yield fork(watchToasterSagas);
yield fork(watchSelectedCustomTypeSagas);
}
Example #7
Source File: index.ts From slice-machine with Apache License 2.0 | 5 votes |
// Saga Exports
export function* watchToasterSagas() {
yield fork(watchOpenToaster);
}
Example #8
Source File: index.ts From slice-machine with Apache License 2.0 | 5 votes |
// Saga Exports
export function* watchSliceSagas() {
yield fork(watchCreateSlice);
}
Example #9
Source File: index.ts From slice-machine with Apache License 2.0 | 5 votes |
// Saga Exports
export function* watchSimulatorSagas() {
yield fork(watchCheckSetup);
}
Example #10
Source File: sagas.ts From slice-machine with Apache License 2.0 | 5 votes |
// Saga Exports
export function* watchSelectedCustomTypeSagas() {
yield fork(watchSaveCustomType);
yield fork(watchPushCustomType);
}
Example #11
Source File: index.ts From slice-machine with Apache License 2.0 | 5 votes |
// Saga Exports
export function* watchAvailableCustomTypesSagas() {
yield fork(watchCreateCustomType);
}
Example #12
Source File: Checkout.saga.ts From react-native-woocommerce with MIT License | 5 votes |
export default function* watchAll() {
yield all([
fork(watchCheckoutCommand)
]);
}
Example #13
Source File: index.ts From FLECT_Amazon_Chime_Meeting with Apache License 2.0 | 5 votes |
// function* handleEnterSession() {
// while (true) {
// const action = yield take('ENTER_SESSION');
// console.log("SAGA")
// console.log(action)
// const base_url = action.payload[0]
// const roomID = encodeURIComponent(action.payload[1])
// const userName = encodeURIComponent(action.payload[2])
// const region = encodeURIComponent(action.payload[3])
// const url = `${API_BASE_URL}meetings/${roomID}/attendees?name=${userName}®ion=${region}`
// console.log(url)
// try{
// let data = yield call((url:string) =>{
// return fetch(url, {
// method: 'POST',
// })
// .then(res => res.json())
// .catch(error => {throw error})
// }, url);
// console.log(data)
// yield put(Actions.join(base_url, decodeURIComponent(roomID), decodeURIComponent(userName), decodeURIComponent(region), data.JoinInfo));
// }catch(e){
// console.log('failed:'+e)
// }
// }
// }
export default function* rootSaga() {
yield fork(handleCreateUser)
yield fork(handleLoginUser)
yield fork(handleCreateMeeting)
yield fork(handleRefreshRoomList)
yield fork(handleJoinMeeting)
yield fork(handleLeaveMeeting)
yield fork(handleGetAttendeeInfomation)
// yield fork(handleEnterSession)
}
Example #14
Source File: saga.ts From react-js-tutorial with MIT License | 5 votes |
export function* gameSaga() {
yield fork(watchAndLog);
yield fork(watchFirstThreeAction);
yield takeEvery(actions.click.type, gameStateWatcher);
}
Example #15
Source File: saga.ts From react-js-tutorial with MIT License | 5 votes |
export function* hashSaga() {
yield fork(updateHash);
}
Example #16
Source File: saga.ts From mamori-i-japan-admin-panel with BSD 2-Clause "Simplified" License | 5 votes |
export default function* rootSaga() {
yield all([fork(updateMessageSaga), fork(getMessagesSaga)]);
}
Example #17
Source File: saga.ts From mamori-i-japan-admin-panel with BSD 2-Clause "Simplified" License | 5 votes |
export default function* rootSaga() {
yield all([fork(showSuccessMessageSaga), fork(showErrorMessageSaga)]);
}
Example #18
Source File: saga.ts From mamori-i-japan-admin-panel with BSD 2-Clause "Simplified" License | 5 votes |
export default function* rootSaga() {
yield all([fork(loginSaga), fork(logoutSaga), fork(autoSignInSaga)]);
}
Example #19
Source File: saga.ts From mamori-i-japan-admin-panel with BSD 2-Clause "Simplified" License | 5 votes |
export default function* rootSaga() {
yield all([
fork(createAdminUserSaga),
fork(getAdminUsersSaga),
fork(deleteAdminUserSaga),
]);
}
Example #20
Source File: Products.saga.ts From react-native-woocommerce with MIT License | 5 votes |
export default function* watchAll() {
yield all([
fork(watchProductsQuery),
fork(watchRefetchProducts),
fork(watchProductsEndReached)
]);
}