Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface EventDispatcher<E>

JavaScript events for custom objects. Eventdispatcher on GitHub

Code Example

//  Adding events to a custom object
class Car extends EventDispatcher {
start() {
this.dispatchEvent( { type: 'start', message: 'vroom vroom!' } );
}
};
// Using events with the custom object
const car = new Car();
car.addEventListener( 'start', function ( event ) {
alert( event.message );
});
car.start();

Type parameters

Hierarchy

Index

Constructors

constructor

Methods

addEventListener

dispatchEvent

  • dispatchEvent(event: E): void

hasEventListener

removeEventListener

Generated using TypeDoc