redux-saga/effects#fork JavaScript 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: SagaManager.js    From movies with MIT License 6 votes vote down vote up
function createAbortableSaga(saga) {
  if (process.env.NODE_ENV === 'development') {
    return function* main() {
      const sagaTask = yield fork(saga);

      yield take(CANCEL_SAGAS_HMR);
      yield cancel(sagaTask);
    };
  }
  return saga;
}
Example #2
Source File: actions.js    From what-front with MIT License 6 votes vote down vote up
export function* studentGroupsWatcher() {
  yield all([
    fork(watchLoadingStudentGroups),
    fork(watchLoadingStudentGroupById),
    fork(watchEditingStudentGroups),
    fork(watchAddingStudentGroup),
    fork(watchLoadingHWStudentGroupsById)
  ]);
}
Example #3
Source File: actions.js    From what-front with MIT License 6 votes vote down vote up
export function* secretariesWatcher() {
  yield all([
    fork(fetchSecretariesWatcher),
    fork(fetchActiveSecretariesWatcher),
    fork(createSecretaryWatcher),
    fork(updateSecretaryWatcher),
    fork(reactivateSecretaryWatcher),
    fork(deleteSecretaryWatcher)
  ]);
}
Example #4
Source File: actions.js    From what-front with MIT License 6 votes vote down vote up
export function* schedulesWatcher() {
  yield all([
    fork(fetchSchedulesWatcher),
    fork(fetchSchedulesByGroupIdWatcher),
    fork(createScheduleWatcher),
    fork(editScheduleWatcher),
    fork(deleteScheduleWatcher),
  ]);
}
Example #5
Source File: actions.js    From what-front with MIT License 6 votes vote down vote up
export function* mentorsWatcher() {
  yield all([
    fork(fetchingMentorsWatcher),
    fork(fetchingMentorsByIdWatcher),
    fork(fetchingActiveMentorsWatcher),
    fork(fetchingMentorsGroupsWatcher),
    fork(fetchingMentorsCoursesWatcher),
    fork(fetchingMentorsLessonsWatcher),
    fork(fetchAsyncMentorFilteredLessonsWatcher),
    fork(addingMentorWatcher),
    fork(editingMentorWatcher),
    fork(deletingMentorWatcher),
    fork(reactivatingMentorWatcher),
  ]);
}
Example #6
Source File: actions.js    From what-front with MIT License 6 votes vote down vote up
export function* lessonsWatcher() {
  yield all([
    fork(fetchLessonsWatcher),
    fork(fetchLessonsByStudentIdWatcher),
    fork(fetchLessonByIdWatcher),
    fork(addLessonWatcher),
    fork(editLessonWatcher),
  ]);
}
Example #7
Source File: actions.js    From what-front with MIT License 6 votes vote down vote up
export function* studentsWatcher() {
  yield all([
    fork(watchLoadingStudents),
    fork(watchLoadingStudentById),
    fork(watchLoadingActiveStudents),
    fork(watchLoadingStudentGroups),
    fork(watchAddingStudent),
    fork(watchEditingStudent),
    fork(watchRemovingStudent),
    fork(watchReactivatingStudent),
  ]);
}
Example #8
Source File: root-saga.js    From what-front with MIT License 6 votes vote down vote up
export function* rootSaga() {
  yield all([
    fork(watchFetchCounter),
    fork(authWatcher),
    fork(mentorsWatcher),
    fork(coursesWatcher),
    fork(studentsWatcher),
    fork(schedulesWatcher),
    fork(themesWatcher),
    fork(lessonsWatcher),
    fork(secretariesWatcher),
    fork(studentGroupsWatcher),
    fork(watchAddAlert),
    fork(dashboardWatcher),
    fork(attachmentsWatcher),
    fork(importWatcher),
    fork(homeworkWatcher),
    fork(eventWatcher),
    fork(homeworkStudentWatcher),
    fork(exportWatcher)
  ]);
}
Example #9
Source File: actions.js    From what-front with MIT License 6 votes vote down vote up
export function* exportWatcher() {
  yield all([
    fork(exportStudentsClassbookWatcher),
    fork(exportStudentClassbookWatcher),
    fork(exportStudentsResultsWatcher),
    fork(exportStudentResultsWatcher),
    fork(exportStudentGroupResultsWatcher),
  ]);
}
Example #10
Source File: actions.js    From what-front with MIT License 6 votes vote down vote up
export function* dashboardWatcher() {
  yield all([
    fork(createStudentsClassbookWatcher),
    fork(createStudentClassbookWatcher),
    fork(createStudentsResultsWatcher),
    fork(createStudentResultsWatcher),
    fork(createStudentGroupResultsWatcher),
  ]);
}
Example #11
Source File: actions.js    From what-front with MIT License 6 votes vote down vote up
export function* coursesWatcher() {
  yield all([
    fork(fetchActiveCoursesWatcher),
    fork(fetchNotActiveCoursesWatcher),
    fork(createCourseWatcher),
    fork(editCourseWatcher),
    fork(deleteCourseWatcher),
    fork(reactivateCourseWatcher),
  ]);
}
Example #12
Source File: sagas.js    From what-front with MIT License 6 votes vote down vote up
export function* authWatcher() {
  yield all([
    fork(loginWatcher),
    fork(logOutWatcher),
    fork(registrationWatcher),
    fork(fetchAssignedUserListWatcher),
    fork(fetchUnAssignedUserListWatcher),
    fork(changePasswordWatcher),
    fork(forgotPasswordWatcher),
    fork(resetPasswordWatcher),
  ]);
}
Example #13
Source File: saga.js    From gedge-platform with Apache License 2.0 6 votes vote down vote up
function* LayoutSaga() {
	yield all([
		fork(watchChangeLayoutType),
		fork(watchChangeLayoutWidth),
		fork(watchChangeLeftSidebarTheme),
		fork(watchChangeLeftSidebarType),
		fork(watchToggleRightSidebar),
		fork(watchShowRightSidebar),
		fork(watchHideRightSidebar),
		fork(watchChangeTopbarTheme)
	]);
}
Example #14
Source File: index.js    From stayaway-app with European Union Public License 1.2 6 votes vote down vote up
export default function* root() {
  yield fork(watchSetupNewAccount);
  yield fork(watchStartTracing);
  yield fork(watchSubmitDiagnosisRequests);
  yield fork(watchSwitchTracing);
  yield fork(watchUpdateStatus);
  yield fork(watchSetErrors);
  yield fork(watchSetInfectionStatus);
  yield fork(watchUpdateLanguage);
  yield fork(watchEnableExposureNotifications);
  yield fork(watchRequestIgnoreBatteryOptimizations);
}
Example #15
Source File: forecast.js    From jc-calendar with MIT License 6 votes vote down vote up
export function* watchGetForecast() {
  let task;
  while (true) {
    const action = yield take(forecastUIActions.GET_FORECAST);
    if (task) {
      yield cancel(task);
    }
    task = yield fork(getForecastDebounced, action);
  }
}
Example #16
Source File: actions.js    From what-front with MIT License 5 votes vote down vote up
export function* importWatcher() {
  yield all([
    fork(sendGroupsWatcher),
    fork(sendStudentsWatcher),
    fork(sendThemesWatcher),
  ]);
}
Example #17
Source File: index.js    From stayaway-app with European Union Public License 1.2 5 votes vote down vote up
export function* startTracing() {
  if (Configuration.UI) {
    yield put(accountActions.setTracingEnabled(true));
    yield put(accountActions.startTracingResult(TRACING_RESULTS.SUCCESS));
    yield take(accountTypes.STOP_TRACING);
    yield put(accountActions.stopTracingResult(TRACING_RESULTS.SUCCESS));
    return;
  }

  const watcher = yield fork(watchTracingStatus);

  // Wait for listener to registered
  yield take(accountTypes.TRACING_STATUS_LISTENER_REGISTERED);
  try {
    const result = yield call(TracingManager.start);

    if (result === GAEN_RESULTS.EN_CANCELLED) {
      if (Platform.OS === 'android') {
        // Show alert
        Alert.alert(
          i18n.translate('common.dialogs.gaen.enable.title'),
          i18n.translate('common.dialogs.gaen.enable.description'),
          [
            {
              text: i18n.translate('common.actions.ok'),
              style: 'default',
            },
          ],
        );
      }

      yield put(accountActions.startTracingResult(TRACING_RESULTS.GAEN));
      yield cancel(watcher);
      return;
    }

    try {
      yield call(TracingManager.sync);

      // Get status
      const status = yield call(TracingManager.getStatus);
      yield put(accountActions.updateStatus(status));
    } catch (error) {
      // Sync error. Probably exposure check limit reached.
      // Clear errors
      yield put(accountActions.setErrors([]));
      console.log(error);
    }

    yield put(accountActions.startTracingResult(TRACING_RESULTS.SUCCESS));
  } catch (error) {
    console.log(error);
    yield put(accountActions.startTracingResult(TRACING_RESULTS.FAILED));
    yield cancel(watcher);
    return;
  }

  try {
    yield take(accountTypes.STOP_TRACING);
    yield cancel(watcher);
    yield call(TracingManager.stop);
    yield put(accountActions.stopTracingResult(TRACING_RESULTS.SUCCESS));
  } catch (error) {
    console.log(error);
    yield put(accountActions.stopTracingResult('ERROR'));
  }
}
Example #18
Source File: rootSaga.js    From movies with MIT License 5 votes vote down vote up
export default function* root() {
  yield all([
    fork(watchMovieBrowser),
    fork(watchMovieDetails)
  ]);
}
Example #19
Source File: index.js    From stayaway-app with European Union Public License 1.2 5 votes vote down vote up
export function* watch() {
  yield fork(startupSagas);
  yield fork(accountSagas);
  yield fork(permissionsSagas);
}
Example #20
Source File: actions.js    From what-front with MIT License 5 votes vote down vote up
export function* themesWatcher() {
  yield all([
    fork(loadThemesWatcher),
    fork(createThemeWatcher),
    fork(editThemeWatcher),
    fork(deleteThemeWatcher),
  ]);
}
Example #21
Source File: index.js    From stayaway-app with European Union Public License 1.2 5 votes vote down vote up
export default function* root() {
  yield fork(watchCheckPermission);
  yield fork(watchCheckAllPermissions);
  yield fork(watchRequestPermission);
  yield fork(watchRequestAllPermissions);
}
Example #22
Source File: index.js    From stayaway-app with European Union Public License 1.2 5 votes vote down vote up
export default function* root() {
  yield fork(watchStartup);
  yield fork(watchAppStateChange);
}
Example #23
Source File: index.js    From lrc-staking-dapp with MIT License 5 votes vote down vote up
combinedEffect = function* () {
  yield all([
    fork(settingsEffect),
    fork(tokenEffect),
    fork(stakingEffect),
    fork(feeEffect),
  ]);
}
Example #24
Source File: saga.js    From crmplatform with GNU Affero General Public License v3.0 5 votes vote down vote up
export default function* routeSaga() {
  yield all([fork(actionWatcher)]);
}
Example #25
Source File: index.js    From pandoa with GNU General Public License v3.0 5 votes vote down vote up
export default function* rootSaga() {
  yield all([
    fork(watcherInfectionsSaga),
    fork(watcherReportSaga),
    fork(watcherCaseSaga)
  ]);
}
Example #26
Source File: socket.js    From haven with MIT License 5 votes vote down vote up
export default function* eventSaga() {
  const socket = yield call(connect);
  yield fork(read, socket);
}
Example #27
Source File: actions.js    From what-front with MIT License 5 votes vote down vote up
export function* homeworkStudentWatcher() {
  yield all([
    fork(getHomeworkStudentWatcher),
    fork(getHomeworkStudentByIdWatcher),
    fork(addHomeworkStudentWatcher),
    fork(updateHomeworkStudentWatcher),
  ]);
}
Example #28
Source File: actions.js    From what-front with MIT License 5 votes vote down vote up
export function* homeworkWatcher() {
  yield all([
    fork(getHomeworkWatcher),
    fork(addHomeworkWatcher),
    fork(updateHomeworkWatcher),
  ]);
}
Example #29
Source File: actions.js    From what-front with MIT License 5 votes vote down vote up
export function* eventWatcher() {
  yield all([
    fork(getEventWatcher),
    fork(updateEventWatcher),
    fork(deleteEventWatcher),
    fork(connectEventToLessonWatcher),
  ]);
}