本文整理汇总了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'
);
}