openrndr / org.openrndr.events / Event

Event

class Event<T> (source)

an event class

Parameters

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

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

Constructors

<init>

an event class

Event(name: String = "<unnamed-event>", postpone: Boolean = false)

Properties

listeners

val listeners: MutableList<(T) -> Unit>

name

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

val name: String

postpone

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

var postpone: Boolean

timeSinceLastTrigger

val timeSinceLastTrigger: Duration

triggerCount

number of times this event is triggered

var triggerCount: Long

Functions

cancel

cancel a listener

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

deliver

deliver postponed event messages

fun deliver(): Unit

listen

add an event message listener

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

listenOnce

fun listenOnce(listener: (T) -> Unit): Unit
fun listenOnce(listener: Event<T>): Unit

trigger

trigger the event

fun trigger(message: T): Unit