subscribe
fun <E : Event, T : EventTarget> T.subscribe(eventName: String, capture: Boolean = false, selector: E.() -> Boolean = { true }): Listener<E, T>
Creates a Listener for the given Event type and eventName.
Return
a Listener-object, which is more or less a Flow of the specific Event
-type.
Parameters
eventName
the DOM-API name of an event. Can be a custom name.
capture
if true
, activates capturing mode, else remains in bubble
mode (default)
selector
optional lambda expression to select specific events with option to manipulate it (e.g. preventDefault
or stopPropagation
).