Skip to main content

TEventQueue

Processes all event handling across the game.

You can provide Web Workers to the constructor to relay any events this queue receives.

Index

Constructors

constructor

  • Parameters

    • relayTo: MessagePort[] = []

      workers to rely all events to

    • childQueues: IChildEventQueue[] = []

    Returns default

Methods

publicaddListener

  • addListener<T>(type: string, func: (event: T) => void): void
  • addListener<T>(type: string, subType: string, func: (event: T) => void): void
  • Add event listener for the given event type with optional sub type.


    Type parameters

    Parameters

    • type: string
    • func: (event: T) => void

      Returns void

    publicbroadcast

    • broadcast(event: TEvent, dontRelay?: boolean): void
    • Adds the event to the event queue, ready to be processed.


      Parameters

      • event: TEvent
      • optionaldontRelay: boolean

      Returns void

    publicremoveListener

    • removeListener<T>(type: string, func: (event: T) => void): void
    • removeListener<T>(type: string, subType: string, func: (event: T) => void): void
    • Removes listener using the given id and function.


      Type parameters

      Parameters

      • type: string
      • func: (event: T) => void

        Returns void

      publicupdate

      • update(): void
      • Returns void