In short, trying to chunk a really large array into chunks of 10 and wait 5 seconds before emitting the next 10.
Here is what I currently have
Rx.Observable
.from(hugeArray)
.bufferCount(10)
.delay(5000) //want to wait 5 secs
.flatMap(e => e) // this needs to go after to flatten the array, buffer spits out arrays of entries
.flatMap( (data, index) => Rx.Observable.create(observer => {
// going to render stuff here
observer.onNext(data)
observer.onCompleted();
}))
.subscribe(val => console.log('Buffered Values:', val));
Just trying to do 10 chunks ever 5 seconds, only been able to do an initial delay and then it emitted the rest.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…