Emitter

open class Emitter

The event emitter which is ported from the JavaScript module. This class is thread-safe.

See also

<a href="https://github.com/component/emitter">https://github.com/component/emitter</a>

Types

Link copied to clipboard
interface Listener

Functions

Link copied to clipboard
open fun emit(event: String, args: Array<Any>): Emitter
Executes each of listeners with the given args.
Link copied to clipboard
open fun hasListeners(event: String): Boolean
Check if this emitter has listeners for the specified event.
Link copied to clipboard
open fun listeners(event: String): List<Emitter.Listener>
Returns a list of listeners for the specified event.
Link copied to clipboard
open fun off(): Emitter
Removes all registered listeners.
open fun off(event: String): Emitter
Removes all listeners of the specified event.
open fun off(event: String, fn: Emitter.Listener): Emitter
Removes the listener.
Link copied to clipboard
open fun on(event: String, fn: Emitter.Listener): Emitter
Listens on the event.
Link copied to clipboard
open fun once(event: String, fn: Emitter.Listener): Emitter
Adds a one time listener for the event.

Inheritors

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard