Options
All
  • Public
  • Public/Protected
  • All
Menu

Class State

State is a store of all of the components of an interactive session.

It contains Scenes, Groups and Participants and keeps them up to date by listening to interactive events which update and change them. You can query State to examine and alter components of the interactive session.

Hierarchy

  • EventEmitter
    • State

Implements

Index

Constructors

constructor

  • Constructs a new State instance. Based on the passed client type it will hook into the appropriate methods for that type to keep itself up to date.

    Parameters

    Returns State

Properties

isReady

isReady: boolean

the ready state of this session, is the GameClient in this session ready to receive input?

Static defaultMaxListeners

defaultMaxListeners: number

Methods

addListener

  • addListener(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

addScenes

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getControl

getGroup

  • getGroup(id: string): Group

getGroups

  • getGroups(): Map<string, Group>

getMaxListeners

  • getMaxListeners(): number
  • Returns number

getParticipantBySessionID

getParticipantByUserID

getParticipantByUsername

getParticipants

getScene

  • getScene(id: string): IScene

getScenes

  • getScenes(): Map<string, Scene>

getWorld

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

on

  • on(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

onGroupCreate

onGroupDelete

  • onGroupDelete(groupID: string, reassignGroupID: string): void
  • Removes a group and reassigns the participants that were in it.

    Parameters

    • groupID: string
    • reassignGroupID: string

    Returns void

onGroupUpdate

onSceneCreate

onSceneDelete

  • onSceneDelete(sceneID: string, reassignSceneID: string): void
  • Removes a scene and reassigns the groups that were on it.

    Parameters

    • sceneID: string
    • reassignSceneID: string

    Returns void

onSceneUpdate

onWorldUpdate

once

  • once(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

processMethod

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

reset

  • reset(): void
  • Completely clears this state instance emptying all Scene, Group and Participant records

    Returns void

setClient

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

synchronizeGroups

synchronizeLocalTime

  • synchronizeLocalTime(time?: Date | number): Date

synchronizeRemoteTime

  • synchronizeRemoteTime(time: Date | number): Date

synchronizeScenes

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc