當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。