EventReceiverImpl

Class for receiving events posted to FlowBus

Parameters

bus

FlowBus instance to subscribe to. If not set, the koin singleton will be used.

Constructors

Link copied to clipboard

Functions

Link copied to clipboard
open override fun EventReceiver.createEventScope(): CoroutineScope
Link copied to clipboard
open override fun <T : Any> EventReceiver.flowOf(clazz: KClass<T>, priority: Priority, ignoreCancelled: Boolean, skipRetained: Boolean): Flow<T>
Link copied to clipboard
open override fun isCancelled(event: Any): Boolean

Checks if this implementation of EventReceiver determines that an event is cancelled.

Link copied to clipboard
open override fun returnOn(dispatcher: CoroutineDispatcher): EventReceiver

Set the CoroutineDispatcher which will be used to launch your callbacks.

Link copied to clipboard
open override fun <T : Any> EventReceiver.subscribeTo(clazz: KClass<T>, callback: EventCallback<T>): EventReceiver

A variant of subscribeTo that uses an instance of EventCallback as callback.

open override fun <T : Any> EventReceiver.subscribeTo(clazz: KClass<T>, priority: Priority, ignoreCancelled: Boolean, skipRetained: Boolean, callback: suspend T.() -> Unit): EventReceiver

Subscribe to events that are type of clazz with the given callback function. The callback can be called immediately if event of type clazz is present in the flow.

Link copied to clipboard
open override fun EventReceiver.unsubscribe()

Unsubscribe from all events

open override fun <T : Any> EventReceiver.unsubscribe(clazz: KClass<T>)

Unsubscribe from events type of clazz

Properties

Link copied to clipboard
open override val EventReceiver.exceptionHandler: CoroutineExceptionHandler
Link copied to clipboard
open override val EventReceiver.supervisorScope: CoroutineScope

Extensions

Link copied to clipboard
inline fun <T : Any> EventReceiver.subscribe(priority: Priority = Priority.DEFAULT, ignoreCancelled: Boolean = false, skipRetained: Boolean = false, noinline callback: suspend T.() -> Unit): EventReceiver

Simplified EventReceiver.subscribeTo for Kotlin. Type of event is automatically inferred from callback parameter type.

A variant of subscribe that uses an instance of EventCallback as callback.

Link copied to clipboard
inline fun <T : Any> EventReceiver.subscribeFlow(priority: Priority = Priority.DEFAULT, ignoreCancelled: Boolean = false, skipRetained: Boolean = false): Flow<T>
Link copied to clipboard
inline fun <T : Any> EventReceiver.unsubscribe()