当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript redux-saga.takeEvery函数代码示例

本文整理汇总了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;
};
开发者ID:e-xtrategy,项目名称:modular-angular2-seed,代码行数:21,代码来源:module.sagas.ts

示例2: takeEvery

 return function*() {
   yield takeEvery(Actions.Transfer.Success, invalidateWorks)
 }
开发者ID:aconly,项目名称:explorer-web,代码行数:3,代码来源:CacheInvalidationSaga.ts

示例3: watchAndLog

 function* watchAndLog(getState) {
   yield* takeEvery('*', function* logger(action) {
     console.log('action', action)
   })
 }
开发者ID:HawkHouseIntegration,项目名称:DefinitelyTyped,代码行数:5,代码来源:redux-saga-tests.ts

示例4:

 return function *rootSaga() {
     yield *takeEvery('*', dispatchSaga);
 }
开发者ID:thinkjs,项目名称:learn-react,代码行数:3,代码来源:sagas.ts

示例5: saga

// watcher saga
function* saga(): Iterable<Effect> {
  yield* takeEvery(isHelloAction, helloSaga);
}
开发者ID:bouzuya,项目名称:peggie2,代码行数:4,代码来源:hello.ts

示例6: takeEvery

 return function*() {
   yield takeEvery(Actions.fetchRequest, fetchData)
 }
开发者ID:aconly,项目名称:explorer-web,代码行数:3,代码来源:FetchSaga.ts

示例7: starwarsFilmsSaga

export function* starwarsFilmsSaga() {
  yield* takeEvery(actions.STARWARS_FILMS_REQUEST, getStarwarsFilms);
}
开发者ID:happylinks,项目名称:vortigern,代码行数:3,代码来源:films.ts

示例8: githubStarsSaga

export function* githubStarsSaga() {
  yield* takeEvery(actions.GITHUB_STARS_REQUEST, getGithubStars);
}
开发者ID:happylinks,项目名称:vortigern,代码行数:3,代码来源:stars.ts

示例9: loginSaga

export function* loginSaga() {
  yield* takeEvery(actions.LOGIN_REQUEST, login);
}
开发者ID:happylinks,项目名称:vortigern,代码行数:3,代码来源:login.ts

示例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'
  );
}
开发者ID:gajus,项目名称:redux-saga,代码行数:34,代码来源:helpers.ts


注:本文中的redux-saga.takeEvery函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。