Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Index

Accessors

eventTypes

  • get eventTypes(): string[]

Methods

addEventListener

  • addEventListener(type: string, listener: (event: Event) => void): void
  • Add a new event listener to the event type.

    Parameters

    • type: string

      The type of event to listen to.

    • listener: (event: Event) => void

      The function that gets called when the event is fired.

        • (event: Event): void
        • Parameters

          • event: Event

          Returns void

    Returns void

dispatchEvent

  • dispatchEvent(event: Event): void

dispose

  • dispose(): void

hasEventListener

  • hasEventListener(type: string, listener?: undefined | ((event: Event) => void)): boolean
  • Checks if listener is added to an event type.

    Parameters

    • type: string

      The type of event to listen to.

    • Optional listener: undefined | ((event: Event) => void)

      The function that gets called when the event is fired.

    Returns boolean

listeners

  • listeners(type: string): Array<(event: Event) => void> | undefined
  • Retrieve the registered listeners to the specified event.

    Parameters

    • type: string

      The type of event to listen to.

    Returns Array<(event: Event) => void> | undefined

    Array of event listeners.

removeAllEventListeners

  • removeAllEventListeners(): void

removeEventListener

  • removeEventListener(type: string, listener?: any): void
  • 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