當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript typesafe-actions.isActionOf函數代碼示例

本文整理匯總了TypeScript中typesafe-actions.isActionOf函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript isActionOf函數的具體用法?TypeScript isActionOf怎麽用?TypeScript isActionOf使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了isActionOf函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: filter

export const trade$: MyEpic = (action$, state$, { placeOrder }) =>
  action$.pipe(
    filter(isActionOf(placeTradeAction.request)),
    mergeMap(({ payload }) =>
      placeOrder({ ...payload }).pipe(
        map((matches) => placeTradeAction.success(matches)),
        catchError((e) => of(placeTradeAction.failure(e))),
      ),
    ),
  )
開發者ID:Carl-Foster,項目名稱:exchange-app,代碼行數:10,代碼來源:trade.ts

示例2: cuid

  (action$, store) => action$
    .filter(isActionOf(todosActions.addTodo))
    .concatMap((action) => { // action is type: { type: "ADD_TODO"; payload: string; }
      const toast = { id: cuid(), text: action.payload.title };

      const addToast$ = Observable.of(toastsActions.addToast(toast));
      const removeToast$ = Observable.of(toastsActions.removeToast(toast.id))
        .delay(TOAST_LIFETIME);

      return addToast$.concat(removeToast$);
    });
開發者ID:vin1992,項目名稱:react-redux-typescript-guide,代碼行數:11,代碼來源:epics.ts

示例3: mergeMap

 mergeMap((action) => timer(0, 1000).pipe(
   mergeMap(() => getDepth(action.payload).pipe(
     map((orders) => getDepthAction.success({ direction: action.payload, orders })),
     catchError((e) => of(getDepthAction.failure(e))),
   )),
   takeUntil(
     merge(
       action$.pipe(filter(isActionOf(getDepthAction.failure))),
       state$.pipe(
         map((state) => state.router.location),
         filter((location) => location.pathname !== ViewPath.dashboard),
       ),
     ),
   ),
 )),
開發者ID:Carl-Foster,項目名稱:exchange-app,代碼行數:15,代碼來源:depth.ts


注:本文中的typesafe-actions.isActionOf函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。