Options
All
  • Public
  • Public/Protected
  • All
Menu

A connection to a timer socket.

Hierarchy

  • TimerConnection

Index

Constructors

constructor

Properties

listeners

listeners: Map<EventName, ((data: Record<string, any>) => void)[]>

observer

observer: boolean

socket

socket: Socket<DefaultEventsMap, DefaultEventsMap>

state

state: null | Timer

Methods

_onError

  • _onError(rawError: Record<string, any>): void

_onStateUpdate

  • _onStateUpdate(rawState: Record<string, any>): void

_triggerEvent

  • _triggerEvent(name: EventName, data: Record<string, any>): Promise<void>

addListener

  • addListener(event: EventName, listener: (data: Record<string, any>) => void): void
  • Add a listener for an event.

    Parameters

    • event: EventName
    • listener: (data: Record<string, any>) => void
        • (data: Record<string, any>): void
        • Parameters

          • data: Record<string, any>

          Returns void

    Returns void

addTime

  • addTime(seconds: number): void
  • Add time to both player's clocks.

    Parameters

    • seconds: number

    Returns void

connect

  • connect(): void

disconnect

  • disconnect(): void

endGame

  • endGame(): void

endTurn

  • endTurn(): void

removeListener

  • removeListener(event: EventName, listener: (data: Record<string, any>) => void): void
  • Remove an added listener.

    Parameters

    • event: EventName
    • listener: (data: Record<string, any>) => void
        • (data: Record<string, any>): void
        • Parameters

          • data: Record<string, any>

          Returns void

    Returns void

startTimer

  • startTimer(): void
  • Start the timer once away has joined (host only).

    Returns void

timeout

  • timeout(): void
  • Notify the server that the current player has timed out.

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Static method

Generated using TypeDoc