首页 > TAG信息列表 > isStable

SAP 电商云 Spartacus UI ActiveCartService 的 isStable API 里的 debounce 和 timer 操作符

这个 isStable API 的实现是 switchMap 和 debounce,[timer](https://www.learnrxjs.io/learn-rxjs/operators/creation/timer) 等操作符的组合。 首先看 timer 的例子: // RxJS v6+ import { timer } from 'rxjs'; //emit 0 after 1 second then complete, since no second argum

SAP 电商云 Spartacus UI ActiveCartService 的 isStable API 里的 EMPTY 操作符

isStable API 源代码如下: return this.activeCartId$.pipe( switchMap((cartId) => this.multiCartService.isStable(cartId)), debounce((state) => (state ? timer(0) : EMPTY)), distinctUntilChanged() ); EMPTY 操作符:直接发送 complete 事件。 看