NodeEventTarget

sealed external interface NodeEventTarget : <ERROR CLASS> ERROR CLASS: Symbol not found for EventTarget(source)

The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API.

Since

v14.5.0

Functions

Link copied to clipboard
abstract fun addListener(type: String, listener: (arg: Any?) -> Unit)

Node.js-specific extension to the EventTarget class that emulates the equivalent EventEmitter API. The only difference between addListener() and addEventListener() is that addListener() will return a reference to the EventTarget.

Link copied to clipboard
abstract fun emit(type: String, arg: Any?): Boolean

Node.js-specific extension to the EventTarget class that dispatches the arg to the list of handlers for type.

Link copied to clipboard
abstract fun eventNames(): ERROR CLASS: Symbol not found for js.array.ReadonlyArray<kotlin/String>

Node.js-specific extension to the EventTarget class that returns an array of event type names for which event listeners are registered.

Link copied to clipboard
abstract fun getMaxListeners(): Double

Node.js-specific extension to the EventTarget class that returns the number of max event listeners.

Link copied to clipboard
abstract fun listenerCount(type: String): Double

Node.js-specific extension to the EventTarget class that returns the number of event listeners registered for the type.

Link copied to clipboard
abstract fun off(type: String, listener: (arg: Any?) -> Unit, options: ERROR CLASS: Symbol not found for EventListenerOptions = definedExternally)

Node.js-specific alias for eventTarget.removeEventListener().

Link copied to clipboard
abstract fun on(type: String, listener: (arg: Any?) -> Unit)

Node.js-specific alias for eventTarget.addEventListener().

Link copied to clipboard
abstract fun once(type: String, listener: (arg: Any?) -> Unit)

Node.js-specific extension to the EventTarget class that adds a once listener for the given event type. This is equivalent to calling on with the once option set to true.

Link copied to clipboard
abstract fun removeAllListeners(type: String = definedExternally)

Node.js-specific extension to the EventTarget class. If type is specified, removes all registered listeners for type, otherwise removes all registered listeners.

Link copied to clipboard
abstract fun removeListener(type: String, listener: (arg: Any?) -> Unit, options: ERROR CLASS: Symbol not found for EventListenerOptions = definedExternally)

Node.js-specific extension to the EventTarget class that removes the listener for the given type. The only difference between removeListener() and removeEventListener() is that removeListener() will return a reference to the EventTarget.

Link copied to clipboard
abstract fun setMaxListeners(n: Number)

Node.js-specific extension to the EventTarget class that sets the number of max event listeners as n.