Companion

Properties

Link copied to clipboard
Link copied to clipboard

Value: Symbol.for('nodejs.rejection')

Link copied to clipboard

By default, a maximum of 10 listeners can be registered for any single event. This limit can be changed for individual EventEmitter instances using the emitter.setMaxListeners(n) method. To change the default for allEventEmitter instances, the events.defaultMaxListeners property can be used. If this value is not a positive number, a RangeError is thrown.

Link copied to clipboard

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Functions

Link copied to clipboard
fun addAbortListener(signal: AbortSignal, resource: (event: Event) -> Unit): Disposable

Listens once to the abort event on the provided signal.

Link copied to clipboard

Returns a copy of the array of listeners for the event named eventName.

Link copied to clipboard

Returns the currently set max amount of listeners.

Link copied to clipboard

A class method that returns the number of listeners for the given eventName registered on the given emitter.

Link copied to clipboard
fun <P : JsTuple> on(emitter: EventEmitter, type: EventType, options: StaticEventEmitterOptions = definedExternally): AsyncIterator<P>
fun <E : Event> on(emitter: EventTarget, type: EventType<E>, options: StaticEventEmitterOptions = definedExternally): AsyncIterator<JsTuple1<E>>

Returns an AsyncIterator that iterates eventName events. It will throw if the EventEmitter emits 'error'. It removes all listeners when exiting the loop. The value returned by each iteration is an array composed of the emitted event arguments.

Link copied to clipboard
fun <P : JsTuple> once(emitter: EventEmitter, type: EventType, options: StaticEventEmitterOptions = definedExternally): Promise<P>
fun <E : Event> once(emitter: EventTarget, type: EventType<E>, options: StaticEventEmitterOptions = definedExternally): Promise<JsTuple1<E>>

Creates a Promise that is fulfilled when the EventEmitter emits the given event or that is rejected if the EventEmitter emits 'error' while waiting. The Promise will resolve with an array of all the arguments emitted to the given event.

Link copied to clipboard
fun setMaxListeners(n: Number = definedExternally, vararg eventTargets: Any)