emitBuffered method

void emitBuffered()

Emit buffered events (received and emitted).

@api private

Implementation

void emitBuffered() {
  var i;
  for (i = 0; i < receiveBuffer.length; i++) {
    List args = receiveBuffer[i];
    if (args.length > 2) {
      Function.apply(super.emit, [args.first, args.sublist(1)]);
    } else {
      Function.apply(super.emit, args);
    }
  }
  receiveBuffer = [];

  for (i = 0; i < sendBuffer.length; i++) {
    packet(sendBuffer[i]);
  }
  sendBuffer = [];
}