The next operator to buffer data lets you buffer data for a certain amount of time. It's called bufferWithTime(). This operator will store data in an array until a given time is elapsed.
The bufferWithTime() method has the following signature:
The first parameter is mandatory and the other two are optional:
- time: This is the time in milliseconds to buffer the data, before propagating it
- skipTime: This is similar to the skip parameter in the bufferWithCount(), but it is the time in milliseconds to skip
- scheduler: This is used to propagate data
An example of the usage of this method is as follows:
Rx.Observable .interval(100) .bufferWithTime(210)