docs: function(type, messageId, json) {
              var self = this;
  
              var listenerList = this.listeners[type] || [];
  
              var executedCount = 0;
  
              var complete = function() {
                  executedCount += 1;
  
                  if (executedCount >= listenerList.length) {
                      self.dispatcher.sendCallback(messageId);
                  }
              };
  
              for (var index = 0; index < listenerList.length; index++) {
                  var listener = listenerList[index];
  
                  // If it's a "sync" listener, we'll call the complete() function
                  // after it has finished. If it's async, we expect it to call complete().
                  if (listener.length <= 1) {
                      listener(json);
                      complete();
                  } else {
                      listener(json, complete);
                  }
              }
  
          }