Class EventDispatcher

JavaScript events for custom objects. Stores all listeners to allow removing all listeners for housekeeping.

Will be replaced by THREE.EventDispatcher once https://github.com/mrdoob/three.js/pull/19844 is released.

Hierarchy

Constructors

Accessors

Methods

  • Add a new event listener to the event type.

    Parameters

    • type: string

      The type of event to listen to.

    • listener: ((event) => void)

      The function that gets called when the event is fired.

        • (event): void
        • Parameters

          • event: Event

          Returns void

    Returns void

  • Checks if listener is added to an event type.

    Parameters

    • type: string

      The type of event to listen to.

    • Optional listener: ((event) => void)

      The function that gets called when the event is fired.

        • (event): void
        • Parameters

          • event: Event

          Returns void

    Returns boolean

  • Retrieve the registered listeners to the specified event.

    Parameters

    • type: string

      The type of event to listen to.

    Returns undefined | ((event) => void)[]

    Array of event listeners.

  • Remove the listener from the event type.

    Parameters

    • type: string

      The type of event to listen to.

    • Optional listener: any

      The function that gets called when the event is fired. If the value is undefined, all listeners will be removed.

    Returns void

Generated using TypeDoc