AbstractComponent

abstract class AbstractComponent : Component

Provides some common implementation that useful to all that interact with RegisteringEventEmitters components, including:

  • Maintaining a reference to an EventEmitter
  • Wraps incoming EventEmitter in a RegisteringEventEmitter
  • Ensures incoming EventEmitter is not null
  • Maintains a collection of EventListener tokens for use with EventEmitter.off()
  • Provides standard required method for initializing Event listeners

Inheritors

Constructors

Link copied to clipboard
constructor(eventEmitter: EventEmitter, componentClass: Class<out Component>)
Being Components, Controllers inheriting from AbstractController require an EventEmitter on initialization.
constructor(eventEmitter: EventEmitter)
Build an AbstractComponent that does not use a registering event emitter.

Functions

Link copied to clipboard
open fun addListener(eventType: String, listener: EventListener)
Convenience method to add an EventListener for the given type using the EventEmitter.on() method.
Link copied to clipboard
open fun addOnceListener(eventType: String, listener: EventListener)
Convenience method to add an EventListener for the given type using the EventEmitter.once() method.
Link copied to clipboard
Provides a reference to the EventEmitter with which this component was initialized
Link copied to clipboard
open fun removeListener(eventType: String)
Removes the specified listener from the EventEmitter.
Link copied to clipboard
open fun removeListeners()
Removes all set listeners from the EventEmitter.