O'Reilly logo

Mastering Reactive JavaScript by Erich de Souza Oliveira

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The bufferWithTimeOrCount() operator

The last operator to buffer data we will see is the bufferWithTimeOrCount()operator. In the last two sessions, we learned about the bufferWithCount() operator which lets us put a limit on the size of the array, and the bufferWithTime() operator which lets us put a limit on the time to fill the buffer. Sometimes we might want to put a maximum on both.

The bufferWithTimeOrCount() method has the following signature:

observable.bufferWithTimeOrCount(time,count,[scheduler]); 

The two first parameter are mandatory and the last is optional:

  • time: This is the time in milliseconds to buffer the data, before propagating it
  • count: This is the maximum size of the buffer
  • scheduler: This is used to propagate the data ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required