addEventListener

fun addEventListener(listener: Listener, scope: Any? = definedExternally): RemoveCallback(source)

Registers a callback function to be executed whenever the event is raised. An optional scope can be provided to serve as the this pointer in which the function will execute.

Return

A function that will remove this event listener when invoked.

Parameters

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