英文:
Rx Observable Sample operator that emits values at the beginning rather than the end of the period
问题
RxJs包含方便的throttleTime操作符,与.NET的Throttle操作符不同,它可以配置为在时间间隔的开始而不是结束时从源序列中发射值。我是否遗漏了什么,还是必须自己实现?
英文:
RxJs includes the handy throttleTime operator that unlike .NET's Throttle operator can be configured to emit values from the source sequence at the beginning of the interval, rather than the end. Am I missing something or do I have to roll my own implementation?
答案1
得分: 1
这相当简单自己实现。
尝试这个:
.Window(TimeSpan.FromSeconds(1.0))
.SelectMany(xs => xs.Take(1));
英文:
It's rather simple to roll your own.
Try this:
source
.Window(TimeSpan.FromSeconds(1.0))
.SelectMany(xs => xs.Take(1));
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论