本文整理匯總了TypeScript中redux-saga/effects.fork函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript fork函數的具體用法?TypeScript fork怎麽用?TypeScript fork使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了fork函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: apiSaga
export function* apiSaga() {
const { apiHost }: ApplicationState = yield select();
yield fork(getComponents);
yield fork(syncWorkspaceState);
yield fork(createSocketIOSaga(io(apiHost)));
yield fork(handlePingPong);
}
示例2: authFlow
export function* authFlow() {
yield fork(watchStorage);
yield fork(redirectOnAuth);
while (true) {
const token = auth.retrieveToken();
if (token) {
const state = yield select(state => state.auth);
if (!state || state.token.toString() !== token.toString()) {
yield put(signinSuccess(token, false));
}
yield call(watchExpiration, token.expiresIn);
} else {
yield call(purgeToken, false);
}
const { signin, signup } = yield race({ signin: take(SIGNIN), signup: take(SIGNUP), overwise: take(SIGNIN_SUCCESS) });
if (signin) {
yield fork(submitSigninForm, signin.resolve, signin.reject);
yield call(createToken, signin);
continue;
}
if (signup) {
yield fork(submitSignupForm, signup.resolve, signup.reject);
yield call(createUser, signup);
continue;
}
}
}
示例3: mainSaga
export function* mainSaga() {
yield fork(ipcSaga);
yield fork(screenshotsSaga);
yield fork(expresssServerSaga);
yield fork(routesSaga);
yield fork(uriWatcherSaga);
}
示例4: rootSaga
export function* rootSaga(): any {
yield all([
fork(posts.postsSaga),
fork(tags.tagsSaga),
fork(summary.summarySaga),
]);
}
示例5: root
export default function* root() {
yield [
fork(githubGistsSaga),
fork(githubStarsSaga),
fork(starwarsFilmsSaga),
fork(authSaga),
];
}
示例6: formsFlow
export function* formsFlow() {
yield [
fork(watchCreate),
fork(watchUpdate),
fork(watchDelete),
fork(watchIndexRedirect),
fork(streamForms),
]
}
示例7: screenshotsSaga
export function* screenshotsSaga() {
yield spawn(handleTakingScreesnshots);
yield fork(handleNewScreenshot);
yield fork(handleSavedScreenshot);
yield fork(cleanupOldScreenshots);
// last thing to launch
yield fork(openHeadlessBrowser);
}
示例8: put
return function* () {
yield put(languagesActions.set([
{ id: 'english', caption: 'English' },
{ id: 'bulgarian', caption: 'Български (Bulgarian)' },
{ id: 'czech', caption: 'čeština (Czech)' },
{ id: 'russian', caption: 'Русский (Russian)' },
]))
yield fork(authSaga, history, authApi, usersApi)
yield fork(router, history, routeSettings)
}
示例9: rootSaga
export default function* rootSaga () {
yield all([
takeEvery('search/query', requestSearch),
takeEvery('search/activeTab', requestSearch),
fork(syncSearchSongs),
fork(syncSearchPlaylists),
fork(syncSearchArtist),
fork(syncSearchAlbums)
])
}
示例10: countdownFlow
function* countdownFlow() {
const tasks: StringKeyValuePair = {};
while (true) {
const action = yield take([
actions.pause,
actions.remove,
actions.reset,
actions.start,
actions.stop,
]);
const countdownId = action.payload;
if (hasSameActionType(action, actions.pause)) {
yield cancel(tasks[countdownId]);
const countdown: Countdown = yield select(({ countdowns }: State) =>
countdowns.find((c: Countdown) => c.id === countdownId),
);
yield put(actions.update(countdownId, {
paused: true,
alarmSoundEnabled: countdown.milliseconds === 0,
}));
}
if (hasSameActionType(action, actions.remove)) {
if (tasks[countdownId]) {
yield cancel(tasks[countdownId]);
}
}
if (hasSameActionType(action, actions.reset)) {
yield cancel(tasks[countdownId]);
const countdown: Countdown = yield select(({ countdowns }: State) =>
countdowns.find((c: Countdown) => c.id === countdownId),
);
if (!countdown.paused) {
tasks[countdownId] = yield fork(countdownInterval, countdownId);
}
}
if (hasSameActionType(action, actions.start)) {
tasks[countdownId] = yield fork(countdownInterval, countdownId);
}
if (hasSameActionType(action, actions.stop)) {
yield put(actions.update(countdownId, { alarmSoundEnabled: false }));
}
}
}