【发布时间】:2020-10-18 16:26:33
【问题描述】:
我有一个听两种动作类型的史诗,只需将它们称为 setSomething 和 setSomethingFast。对于这些动作,我想使用具有特定值的 debounceTime。问题是我如何知道它当前是哪种动作类型,以便我可以相应地设置去抖动量? ofType 操作符在这里返回一个 Observable,所以我不能在那里使用它。
export const postSomethingEpic = (
action$: ActionsObservable<PayloadAction<Something[]>>,
state$: StateObservable<RootState>
): Observable<any> =>
action$.pipe(
ofType(setSomething.type, setSomethingFast.type),
debounceTime(**action$.ofType(##setSomethingFast##)** ? 0 : 2500), <-- How can I tell which action here is which?
...
...
【问题讨论】:
标签: react-redux redux-observable