我有无尽的事件流,我需要将事件限制为5个,其余的都暂停3秒
因此,每5个通话后需要延迟
答案 0 :(得分:2)
const obj = { a: 1, b: 2 }
// You can access its item values by key:
array.a => 1
array['b'] => 2
您可以在我制作的this stackblitz中看到。
答案 1 :(得分:1)
const stream = range(0, 100) // create dataset
.pipe(
bufferCount(5), // slice data into chunks
concatMap( // get this chunk
(msg) => of(msg).pipe(
delay(3000) // and emit every three seconds
))
)
stream.subscribe(item => console.log(item));