我有一个onclick事件,并且每个事件都有5秒钟的反跳,然后我调度了一些动作。
例如:
0s click --> 5s later dipsatch
2s click --> 7s later dispatch
2s click --> 7s later dispatch
5s click --> 10s later dispatch
@Effect()
stream$: Observable<any> = this.actions$
.pipe(
ofType(AnAction),
debounceTime(5000),
concatMap(() => {
return this.store.select(selectSomething);
})
map((something: any) => {
console.log('here');
return new DoneAction(something);
})
);
例如,当我立即分派AnAction()
三次时,“ here”`字符串仅记录一次(第一个)。怎么了?