Event Bus
object EventBus
Functions
Link copied to clipboard
fun initialize(vararg packageNames: String, threadPoolSize: Int = Runtime.getRuntime().availableProcessors(), isDebug: Boolean = false)
Initializes the EventBus, setting up the asynchronous executor service. Also registers a shutdown hook to cleanly shut down the executor service on application exit.
Link copied to clipboard
fun <T : Event> postDelayed(event: T, delay: Long, timeUnit: TimeUnit, processingType: EventProcessingType): T
Posts an event to be handled after a specified delay by all registered hooks for the event's class.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Posts an event to be handled synchronously by all registered hooks for the event's class and returns the result.
Link copied to clipboard
fun <T : Event> postWithCallback(event: T, callback: (T) -> Unit, delay: Long?, processingType: EventProcessingType): T
Posts an event to be handled asynchronously, with a callback executed upon completion.
Link copied to clipboard
fun <T : Event> postWithTimeout(event: T, timeout: Long, timeUnit: TimeUnit, processingType: EventProcessingType): T
Posts an event to be handled within a specified timeout by all registered hooks for the event's class.
Link copied to clipboard
Processes an event based on the specified processing type.
Link copied to clipboard
Link copied to clipboard
fun <T : ReturnableEvent<R>, R> registerReturnableEventHook(eventClass: Class<T>, eventHook: ReturnableEventHook<T, R>)
Registers a returnable event hook for a specific event class.
Link copied to clipboard
Link copied to clipboard
fun <T : ReturnableEvent<R>, R> unregisterReturnableEventHook(eventClass: Class<T>, eventHook: ReturnableEventHook<T, R>)
Unregisters a returnable event hook for a specific event class.