code: function(total, timeout) {
    events.EventEmitter.call(this);
  
    if (! isPositiveInteger(total)) {
      throw new Error('`total` must be a positive integer');
    }
  
    if (timeout && ! isPositiveInteger(timeout)) {
      throw new Error('`timeout` must be a positive integer');
    }
  
    this.destroyed = false;
    this.total = total;
  	this.fired = 0;
    if (timeout) {
      this.timer = setTimeout(function() {
        this.onTimeout();
      }.bind(this), timeout);
    }
  }
docs: EventCollector class.
  
  @class EventCollector
  @constructor
  @param {Number} total  Number of events that must fire.