Event

class Event<T>(name: String, postpone: Boolean)
class Event<T>(name: String, 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

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

Functions

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

cancel a listener

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

deliver postponed event messages

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

add an event message listener

fun listen(listener: (T) -> Unit): (T) -> Unit
fun listen(listener: Event<T>): (T) -> Unit
fun listen(listener: Event<T>): (T) -> Unit
listenOnce
Link copied to clipboard
common
fun listenOnce(listener: (T) -> Unit)
fun listenOnce(listener: Event<T>)
postpone
Link copied to clipboard
fun postpone(postpone: Boolean): Event<T>
trigger
Link copied to clipboard
common
fun trigger(message: T)
fun trigger(message: T)

trigger the event

Properties

listeners
Link copied to clipboard
val listeners: MutableList<(T) -> Unit>
name
Link copied to clipboard
js
val name: String
name
Link copied to clipboard
val name: String
postpone
Link copied to clipboard
js
val postpone: Boolean
postpone
Link copied to clipboard
var postpone: Boolean
timeSinceLastTrigger
Link copied to clipboard
val timeSinceLastTrigger: Duration
triggerCount
Link copied to clipboard
var triggerCount: Long = 0L

number of times this event is triggered