本文整理汇总了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);
}
开发者ID:cryptobuks,项目名称:tandem,代码行数:7,代码来源:api.ts
示例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;
}
}
}
开发者ID:rosendi,项目名称:figure,代码行数:34,代码来源:auth.ts
示例3: mainSaga
export function* mainSaga() {
yield fork(ipcSaga);
yield fork(screenshotsSaga);
yield fork(expresssServerSaga);
yield fork(routesSaga);
yield fork(uriWatcherSaga);
}
开发者ID:cryptobuks,项目名称:tandem,代码行数:7,代码来源:index.ts
示例4: rootSaga
export function* rootSaga(): any {
yield all([
fork(posts.postsSaga),
fork(tags.tagsSaga),
fork(summary.summarySaga),
]);
}
开发者ID:weiweiwitch,项目名称:third-lab,代码行数:7,代码来源:sagas.ts
示例5: root
export default function* root() {
yield [
fork(githubGistsSaga),
fork(githubStarsSaga),
fork(starwarsFilmsSaga),
fork(authSaga),
];
}
开发者ID:happylinks,项目名称:vortigern,代码行数:8,代码来源:index.ts
示例6: formsFlow
export function* formsFlow() {
yield [
fork(watchCreate),
fork(watchUpdate),
fork(watchDelete),
fork(watchIndexRedirect),
fork(streamForms),
]
}
开发者ID:rosendi,项目名称:figure,代码行数:9,代码来源:forms.ts
示例7: screenshotsSaga
export function* screenshotsSaga() {
yield spawn(handleTakingScreesnshots);
yield fork(handleNewScreenshot);
yield fork(handleSavedScreenshot);
yield fork(cleanupOldScreenshots);
// last thing to launch
yield fork(openHeadlessBrowser);
}
开发者ID:cryptobuks,项目名称:tandem,代码行数:9,代码来源:screenshots.ts
示例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)
}
开发者ID:steam-react,项目名称:steam,代码行数:10,代码来源:index.ts
示例9: rootSaga
export default function* rootSaga () {
yield all([
takeEvery('search/query', requestSearch),
takeEvery('search/activeTab', requestSearch),
fork(syncSearchSongs),
fork(syncSearchPlaylists),
fork(syncSearchArtist),
fork(syncSearchAlbums)
])
}
开发者ID:czb128abc,项目名称:gouqi,代码行数:10,代码来源:search.ts
示例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 }));
}
}
}
开发者ID:danilobjr,项目名称:PomodoroTimer,代码行数:54,代码来源:countdowns.ts
注:本文中的redux-saga/effects.fork函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论