最後の要素が更新されるときに間隔を停止しようとしています。最後の要素が更新されるときの間隔をクリアする
私は方法がわかりません。私はトラックで始めることができますか?
現時点では、ページを離れるときに私の間隔をクリアします。
this.subscriptions.push(this.requestId.subscribe(id => {
this.store.dispatch(new requestActions.LoadRequest(id));
this.interval = setInterval(() => {
this.store.dispatch(new requestActions.LoadRequest(id));
}, 1700);
}));
マイ効果:
@Effect()
loadRequest$: Observable<Action> = this.actions$
.ofType<requestActions.LoadRequest>(requestActions.LOAD_REQUEST)
.switchMap(action => {
return this.apiService
.loadRequest(action.payload)
.map((task: RequestTask[]) => new requestActions.LoadRequestSuccessAction(task))
.catch(error => of(new requestActions.LoadRequestFailureAction(error)));
});
私の減速:
case request.LOAD_REQUEST_SUCCESS:
console.log("Payload : ", action.payload);
return {
...adapter.addAll(action.payload, state),
loaded: true,
selectedIndex: null
} as State;
私はあなたが正直に達成しようとしているものを得ることはありません。あなたはもっと明確になりますか? – AndreaM16