Package-level declarations

Types

Link copied to clipboard
interface Cancellable

Optional interface for events that support cancellation.

Link copied to clipboard
interface Event

Marker interface for all events that can be dispatched through an EventBus.

Link copied to clipboard
interface EventBus

Central event dispatch interface.

Link copied to clipboard
interface Modifiable<T>

Optional interface for events that carry a mutable result value.

Link copied to clipboard
object Priority

Predefined priority constants for use with @Subscribe and lambda subscribe overloads.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class Subscribe(val priority: Int = Priority.NORMAL, val async: Boolean = false)

Marks a method as an event handler to be discovered by an EventBus.

Link copied to clipboard

Handle returned by lambda-based EventBus.subscribe overloads.

Link copied to clipboard
interface TypedEventBus<E : Event>

Type-safe view over an EventBus that restricts posting and subscribing to subtypes of E.

Functions

Link copied to clipboard
inline fun <T : Event> EventBus.isListening(): Boolean
inline fun <T : Event> TypedEventBus<*>.isListening(): Boolean

Returns true if at least one handler is registered for T or any of its supertypes.

Link copied to clipboard
inline fun <T : Event> EventBus.subscribe(priority: Int = Priority.NORMAL, async: Boolean = false, noinline handler: (T) -> Unit): Subscription

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

inline fun <T : Event> TypedEventBus<in T>.subscribe(priority: Int = Priority.NORMAL, async: Boolean = false, noinline handler: (T) -> Unit): Subscription

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

Link copied to clipboard
fun EventBus.subscribeAll(priority: Int = Priority.NORMAL, handler: (Event) -> Unit): Subscription

Registers a wildcard handler with Priority.NORMAL as the default priority.

fun TypedEventBus<*>.subscribeAll(priority: Int = Priority.NORMAL, handler: (Event) -> Unit): Subscription

Registers a wildcard handler on this TypedEventBus with Priority.NORMAL as the default priority.

Link copied to clipboard
inline fun <E : Event> EventBus.typed(): TypedEventBus<E>
fun <E : Event> EventBus.typed(rootClass: Class<E>): TypedEventBus<E>

Returns a TypedEventBus view over this bus restricted to subtypes of E.