JavaScript events for custom objects
var Car = function () {
EventDispatcher.call( this );
this.start = function () {
this.dispatchEvent( { type: 'start', message: 'vroom vroom!' } );
};
};
var car = new Car();
car.addEventListener( 'start', function ( event ) {
alert( event.message );
} );
car.start();
Adds a listener to an event type.
The type of the listener that gets removed.
The listener function that gets removed.
Fire an event type.
Adds a listener to an event type.
The type of the listener that gets removed.
The listener function that gets removed.
Removes a listener from an event type.
The type of the listener that gets removed.
The listener function that gets removed.