![](/img/trans.png)
[英]Shoutcast stream buffering with Adobe AIR without using Flash/Flex player?
[英]Throttle stream without buffering
我有一些祝詞,我想節制。 我嘗試使用緩沖區,但是當我真正想要的是讓消息只是停留在流中直到我要求它們時,然后我在數組中收到了一堆消息。 我最終要做的是用間隔流壓縮消息流
var messageStream = Rx.Observable.FromEvent(..., 'click');
var intervalStream = Rx.Observable.interval(5000);
messageStream.Zip(intervalStream, (x,_)=>x).subscribe(showToast(x));
有沒有更優雅的方法可以做到這一點?
這是一種使用緩沖區的方法,然后使用flatMap展開數組:
var messageStream = Rx.Observable.FromEvent(..., 'click');
var intervalStream = Rx.Observable.interval(5000);
messageStream
.buffer(intervalStream)
.flatMap( function (x) {
return Rx.Observable.from(x)
})
.subscribe( function (x) {
showToast(x)
})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.