本文整理匯總了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))),
),
),
)
示例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$);
});
示例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),
),
),
),
)),