JavaScript events for custom objects

// 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();

Hierarchy (view full)

Constructors

Properties

cameraAutoUpdate: boolean
true
enabled: boolean
false
isPresenting: boolean
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