[name]
JavaScript events for custom objects.
Example
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();
Constructor
[name]()
Creates eventDispatcher object. It needs to be called with '.call' to add its functionality to an object.
Methods
.addEventListener( [page:String type], [page:Function listener] )
type - The type of event to listen to.
listener - The function that gets called when the event is fired.
Adds a listener to an event type.
.removeEventListener( [page:String type], [page:Function listener] )
type - The type of the listener that gets removed.
listener - The listener function that gets removed.
Removes a listener from an event type.
.dispatchEvent( [page:String type] )
type - The type of event that gets fired.
Fire an event type.
Source
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]