Capturing every event can get chatty. Batching events with a throttled buffer in RxJS lets you capture all of those events and use them responsibly without overloading a subscriber downstream.

 

var Observable = Rx.Observable;
var button = document.getElementById('btn');
var clicks = Observable.fromEvent(button,'click');
var source = clicks.scan(0, function(x){
  return  x+1;
})
.buffer(clicks.debounce(1000))
.forEach(function(x){
  sendValues(x);
});

function sendValues(arr) {
  var pre = document.createElement('pre');
  pre.innerHTML = JSON.stringify(arr);
  document.querySelector('#results')
    .appendChild(pre);
}