code: function CountFunction(win) {
    var self = this, n;
    self.name = "count";
    self.type = "simple";
    self.init = function() { n = 0; };
    self.accumulate = function(ignored) { n += 1; };
    self.compensate = function(ignored) { n -= 1; };
    self.emit = function()  { return n; };
    self.make = function(win) { return new CountFunction(win); };
  }
docs: Count all the things