简体   繁体   English

使用startWith时,RxJS跳过去抖动

[英]RxJS skip debounce when using startWith

I have a stream that uses the startWith operator and debounceTime . 我有一个使用流startWith运营商和debounceTime I want the first value to skip the debounceTime and start immediately. 我希望第一个值跳过debounceTime并立即启动。 How can I do it? 我该怎么做?

control.valueChanges
    .pipe(
      startWith(control.value), <=== this needs to skip debounce
      debounceTime(200),
      map(...),
    );

Just switch the order of operators and use startWith after debounceTime . 只需切换运营商的订单,并使用startWithdebounceTime

control.valueChanges.pipe(
  debounceTime(200),
  startWith(control.value),
  map(...),
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM