channelEventKeyOf
inline fun <T : ChannelEvent<T>> channelEventKeyOf(capacity: ChannelEventBusCapacity = ChannelEventBusCapacity.UNLIMITED): ChannelEventKey<T>
Retrieve the ChannelEvent.Key for T.
You should cache the result of this function to avoid unnecessary object creation, for example:
@JvmField
val awesomeEventKey = channelEventKeyOf<AwesomeEvent>()
bus.receiveAsFlow(awesomeEventKey).collect { e: AwesomeEvent -> println(e) }
Content copied to clipboard