EventReceiver

interface EventReceiver

Functions

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

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

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

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

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

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

abstract fun <T : Any> EventReceiver.subscribeTo(clazz: KClass<T>, priority: Priority = Priority.DEFAULT, ignoreCancelled: Boolean = false, skipRetained: Boolean = false, 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
abstract fun EventReceiver.unsubscribe()

Unsubscribe from all events

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

Unsubscribe from events type of clazz

Properties

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

Inheritors

Link copied to clipboard

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()