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