once

abstract fun once(emitter: EventEmitter, name: String): JsPromise<Unit>

Adds a one-time listener function for the event named name to the emitter. The next time name is triggered, this listener is removed and then invoked.

Parameters

emitter

The EventEmitter to add the listener to.

name

The name of the event to listen for.


abstract fun once(emitter: EventEmitter, name: String, options: Value): JsPromise<Unit>
abstract fun once(emitter: EventEmitter, name: String, options: EventsOnceOptions): JsPromise<Unit>

Adds a one-time listener function for the event named name to the emitter. The next time name is triggered, this listener is removed and then invoked.

Parameters

emitter

The EventEmitter to add the listener to.

name

The name of the event to listen for.

options

The options to use when adding the listener.