Package-level declarations

Types

Link copied to clipboard
sealed interface SuspendHandlerBehaviour

Controls how a suspend handler behaves when a new event arrives.

Functions

Link copied to clipboard
inline fun <T : Event> EventBus.asFlow(priority: Int = Priority.NORMAL): Flow<T>

Returns a Flow that emits every event of type T posted to this EventBus.

inline fun <T : Event> TypedEventBus<in T>.asFlow(priority: Int = Priority.NORMAL): Flow<T>

Returns a Flow that emits every event of type T posted to this TypedEventBus.

Link copied to clipboard
inline suspend fun <T : Event> EventBus.nextEvent(priority: Int = Priority.NORMAL, crossinline predicate: (T) -> Boolean = { true }): T

Suspends until the next event of type T matching predicate is posted, then resumes with that event.

inline suspend fun <T : Event> TypedEventBus<in T>.nextEvent(priority: Int = Priority.NORMAL, crossinline predicate: (T) -> Boolean = { true }): T

Suspends until the next event of type T matching predicate is posted on this TypedEventBus, then resumes with that event.

Link copied to clipboard
inline suspend fun <T : Event> EventBus.nextEventOrNull(timeout: Duration, priority: Int = Priority.NORMAL, crossinline predicate: (T) -> Boolean = { true }): T?

Suspends until the next event of type T matching predicate is posted, or until timeout elapses, whichever comes first.

inline suspend fun <T : Event> TypedEventBus<in T>.nextEventOrNull(timeout: Duration, priority: Int = Priority.NORMAL, crossinline predicate: (T) -> Boolean = { true }): T?

Suspends until the next event of type T matching predicate is posted on this TypedEventBus, or until timeout elapses.

Link copied to clipboard
suspend fun <T : Event> EventBus.postSuspend(event: T, context: CoroutineContext = EmptyCoroutineContext): T

Dispatches event on context and suspends until all handlers have finished.

Link copied to clipboard
inline fun <T : Event> EventBus.suspendHandler(priority: Int = Priority.NORMAL, behaviour: SuspendHandlerBehaviour = SuspendHandlerBehaviour.Parallel, scope: CoroutineScope? = null, crossinline handler: suspend (T) -> Unit): Subscription

Registers a suspend handler for event type T and returns a Subscription token.

inline fun <T : Event> TypedEventBus<in T>.suspendHandler(priority: Int = Priority.NORMAL, behaviour: SuspendHandlerBehaviour = SuspendHandlerBehaviour.Parallel, scope: CoroutineScope? = null, crossinline handler: suspend (T) -> Unit): Subscription

Registers a suspend handler for event type T on this TypedEventBus and returns a Subscription token.