Event

open class Event<T>(source)

The base event implementation with synchronous listeners. To create a new event of this type, have a look at the onlySync and syncAsync functions in the companion object.

Inheritors

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The listeners added by listen, sorted by EventPriority via the index in the outer list.

Link copied to clipboard

The listeners added by monitor.

Functions

Link copied to clipboard
open fun invoke(instance: T)

Invokes this event. Calling this function will trigger all listeners and collectors.

Link copied to clipboard
fun listen(priority: EventPriority = EventPriority.NORMAL, register: Boolean = true, callback: (MutableEventScope, event: T) -> Unit): ListenerInstance<*>

Listens to this event. The callback will always be called synchronously. This function is synchronized, so it may be called from any thread.

Link copied to clipboard
fun monitor(register: Boolean = true, callback: (T) -> Unit): ListenerInstance<*>

Monitors this event. This is the same as listen, but you do not have access to the mutable functions of the event scope. This callback will be executed after EventPriority.LAST, therefore monitor sees the final state.