add

fun add(event: DefaultEvent, listener: () -> Unit, scope: Any? = definedExternally): RemoveCallback(source)

Adds a listener to an event, and records the registration to be cleaned up later.

Return

A function that will remove this event listener when invoked.

Parameters

event

The event to attach to.

listener

The function to be executed when the event is raised.

scope

An optional object scope to serve as the this pointer in which the listener function will execute.

See also