EventChannel

constructor(capacity: Int = Channel.BUFFERED, onUndeliveredElement: (T) -> Unit? = null)(source)

Parameters

capacity

buffer capacity, Channel.BUFFERED by default. When the buffer is full send suspends and trySend returns false, so the sender always learns about a rejected event.

onUndeliveredElement

called with an event that was accepted by the channel but could not be delivered: its collector was cancelled first, or the channel was closed without being drained. It may run concurrently and must not throw. null by default (such events are dropped).

Type Parameters

T

the event type.