emit method
Emit an event to all listeners and add it to the buffer.
The buffer is a FIFO circular queue: when _bufferMax is exceeded,
the oldest event is evicted.
Implementation
void emit(CausalEvent event) {
_buffer.add(event);
if (_buffer.length > _bufferMax) {
_buffer.removeAt(0);
}
if (!_controller.isClosed) {
_controller.add(event);
}
}