JavaScript events for custom objects

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', ( event ) => {
alert( event.message );
} );
car.start();

See

Hierarchy (view full)

Constructors

Properties

cameraAutoUpdate: boolean

Default

true
enabled: boolean

Default

false
isPresenting: boolean

Default

false

Methods

  • Returns void

  • Returns XRWebGLLayer | XRProjectionLayer

  • Returns XRWebGLBinding

  • Parameters

    • index: number

    Returns XRTargetRaySpace

  • Parameters

    • index: number

    Returns XRGripSpace

  • Returns undefined | number

  • Returns XRFrame

  • Parameters

    • index: number

    Returns XRHandSpace

  • Returns null | XRReferenceSpace

  • Returns null | XRSession

  • Parameters

    • callback: null | XRFrameRequestCallback

    Returns void

  • Parameters

    • value: number

    Returns void

  • Parameters

    • value: number

    Returns void

  • Parameters

    • value: XRReferenceSpace

    Returns void

  • Parameters

    • value: XRReferenceSpaceType

    Returns void

  • Parameters

    • value: null | XRSession

    Returns Promise<void>

  • Parameters

    Returns void