EventDispatcher

class EventDispatcher(onRemoveEntryKey: (removedKey: String) -> Unit)

Implements a list of registered event callbacks.

Parameters

onRemoveEntryKey

callback triggered when all events from channel entry have been removed (it can also unsubscribe from the channel)

Constructors

Link copied to clipboard
constructor(onRemoveEntryKey: (removedKey: String) -> Unit)

Functions

Link copied to clipboard
suspend fun <T : Any> emit(event: Event<out T>)

Emits specified event. It should only be called by event loops.

Link copied to clipboard
suspend fun <T : Any> register(channel: String, type: String, context: Any, callback: EventCallback<T>): Boolean

Registers new event callback.

Link copied to clipboard
suspend fun unbind(context: Any)

Removes all callbacks registered by EventDispatcher.register. It's identified by given Context.

Link copied to clipboard
suspend fun unbindAll()

Removes all callbacks.