Event

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

an event class

Parameters

name

a name for the event, this is 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 fun Event(name: String = "<unnamed-event>", postpone: Boolean = false)
actual fun Event(name: String, postpone: Boolean)
actual fun Event(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
val name: String
val name: String
Link copied to clipboard
val postpone: Boolean
var postpone: Boolean
Link copied to clipboard
val timeSinceLastTrigger: Duration
Link copied to clipboard
var triggerCount: Long = 0

number of times this event is triggered

Sources

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard