本文整理匯總了TypeScript中redux-saga.takeEvery函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript takeEvery函數的具體用法?TypeScript takeEvery怎麽用?TypeScript takeEvery使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了takeEvery函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: require
const { takeEvery } = require('redux-saga');
const { call, put } = require('redux-saga/effects');
import fetchSagaFactory from '../../shared/state/fetch-saga-factory';
import Users from '../services/users/users.service';
import { Actions } from "./module.actions";
const getUserSaga = function*() {
try{
const users = yield call(Users.listUsers);
yield put(Actions.usersReceived(users));
} catch(e) {
yield put(Actions.fetchUsersError(e));
}
};
const sagas = [takeEvery('FETCH_USER_LIST', fetchSagaFactory(getUserSaga))];
export default function* rootSaga() {
yield sagas;
};
示例2: takeEvery
return function*() {
yield takeEvery(Actions.Transfer.Success, invalidateWorks)
}
示例3: watchAndLog
function* watchAndLog(getState) {
yield* takeEvery('*', function* logger(action) {
console.log('action', action)
})
}
示例4:
return function *rootSaga() {
yield *takeEvery('*', dispatchSaga);
}
示例5: saga
// watcher saga
function* saga(): Iterable<Effect> {
yield* takeEvery(isHelloAction, helloSaga);
}
示例6: takeEvery
return function*() {
yield takeEvery(Actions.fetchRequest, fetchData)
}
示例7: starwarsFilmsSaga
export function* starwarsFilmsSaga() {
yield* takeEvery(actions.STARWARS_FILMS_REQUEST, getStarwarsFilms);
}
示例8: githubStarsSaga
export function* githubStarsSaga() {
yield* takeEvery(actions.GITHUB_STARS_REQUEST, getGithubStars);
}
示例9: loginSaga
export function* loginSaga() {
yield* takeEvery(actions.LOGIN_REQUEST, login);
}
示例10: testTakeEvery
function* testTakeEvery(): SagaIterator {
// typings:expect-error
yield* takeEvery();
// typings:expect-error
yield* takeEvery('foo');
// typings:expect-error
yield* takeEvery(channel);
yield* takeEvery('foo', (action: Action) => {});
// typings:expect-error
yield* takeEvery(channel, (action: Action) => {});
yield* takeEvery(channel, (action: {foo: string}) => {});
// typings:expect-error
yield* takeEvery(channel, (a: 'a', action: {foo: string}) => {});
// typings:expect-error
yield* takeEvery(channel, (a: 'a', action: {foo: string}) => {}, 1);
yield* takeEvery(channel, (a: 'a', action: {foo: string}) => {}, 'a');
// typings:expect-error
yield* takeEvery(channel, (action: {foo: string}) => {}, 1);
// typings:expect-error
yield* takeEvery(channel,
(a: 'a', b: 'b', c: 'c', d: 'd', e: 'e', f: 'f', g: 'g',
action: {foo: string}) => {},
1, 'b', 'c', 'd', 'e', 'f', 'g'
);
yield* takeEvery(channel,
(a: 'a', b: 'b', c: 'c', d: 'd', e: 'e', f: 'f', g: 'g',
action: {foo: string}) => {},
'a', 'b', 'c', 'd', 'e', 'f', 'g'
);
}