Event

expect class Event<T>(name: String = "<unnamed-event>", postpone: Boolean = false)(source)
actual class Event<T>(val name: String, val postpone: Boolean)(source)
actual class Event<T>(val name: String, var postpone: Boolean)(source)

an event class

Parameters

name

a name for the event, this is used for logging and debugging purposes only, default is ""

postpone

should message delivery for this event be postponed, default is false

Constructors

Link copied to clipboard
expect constructor(name: String = "<unnamed-event>", postpone: Boolean = false)
actual constructor(name: String, postpone: Boolean)
actual constructor(name: String, postpone: Boolean)

Functions

Link copied to clipboard
expect fun cancel(listener: (T) -> Unit)

cancel a listener

actual fun cancel(listener: (T) -> Unit)

cancel a listener

actual fun cancel(listener: (T) -> Unit)
Link copied to clipboard
expect fun deliver()
actual fun deliver()
actual fun deliver()

deliver postponed event messages

Link copied to clipboard
expect fun listen(listener: (T) -> Unit): (T) -> Unit

add an event message listener

expect fun listen(listener: Event<T>): (T) -> Unit
actual fun listen(listener: (T) -> Unit): (T) -> Unit

add an event message listener

actual fun listen(listener: Event<T>): (T) -> Unit
actual fun listen(listener: (T) -> Unit): (T) -> Unit
actual fun listen(listener: Event<T>): (T) -> Unit
Link copied to clipboard
expect fun listenOnce(listener: (T) -> Unit)
expect fun listenOnce(listener: Event<T>)
actual fun listenOnce(listener: (T) -> Unit)
actual fun listenOnce(listener: Event<T>)
actual fun listenOnce(listener: (T) -> Unit)
actual fun listenOnce(listener: Event<T>)
Link copied to clipboard
expect fun trigger(message: T)
actual fun trigger(message: T)
actual fun trigger(message: T)

trigger the event

Properties

Link copied to clipboard
expect val listeners: MutableList<(T) -> Unit>
actual val listeners: MutableList<(T) -> Unit>
actual val listeners: MutableList<(T) -> Unit>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

number of times this event is triggered