Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Challenge

Index

Constructors

constructor

  • new Challenge(container: DIContainer, current_player_id: string): Challenge
  • Parameters

    • container: DIContainer
    • current_player_id: string

    Returns Challenge

Accessors

challengeId

  • get challengeId(): string | undefined
  • Returns string | undefined

contextId

  • get contextId(): string
  • Returns the context id the challenge refers to.

    Returns string

data

  • get data(): object
  • Returns object

duration

  • get duration(): number
  • Returns the challenge duration in seconds

    Returns number

expired

  • get expired(): boolean
  • Returns boolean

playerIds

  • get playerIds(): string[]
  • Returns the ids of player in the challenge (your included)

    Returns string[]

time_left

  • get time_left(): number
  • Returns the time left in the challenge

    Returns number

updated_at

  • get updated_at(): number
  • Timestamp of when this challenge data was updated

    Returns number

Methods

delete

  • delete(): Promise<boolean>
  • Returns Promise<boolean>

getChallengerId

  • getChallengerId(): undefined | string
  • Returns undefined | string

getOpponentId

  • getOpponentId(): string | undefined
  • Returns the player id of the opponent Should only be used in challenges between two players

    Returns string | undefined

getOpponentScore

  • getOpponentScore(): number
  • Returns the score

    Returns number

getPlayerId

  • getPlayerId(): string
  • Returns string

getPlayerScore

  • getPlayerScore(): number
  • Returns the score for the current player

    Returns number

getScore

  • getScore(player_id: string | undefined): number
  • Get Challenge score for a player id.

    Parameters

    • player_id: string | undefined

    Returns number

getShareToken

  • getShareToken(): string
  • Returns string

hasScore

  • hasScore(player_id: string | undefined): boolean
  • Parameters

    • player_id: string | undefined

    Returns boolean

loadShareToken

  • loadShareToken(token: string | any): boolean
  • Parameters

    • token: string | any

    Returns boolean

opponentHasScore

  • opponentHasScore(): boolean
  • Returns true if the second player has a score set

    Returns boolean

parse

  • Parameters

    • data: any

    Returns Challenge | undefined

playerHasScore

  • playerHasScore(): boolean
  • Returns true if the current player has a score set

    Returns boolean

save

  • save(): Promise<boolean>
  • Saves the challenge information in current session data The challenge is only commit on context switching or leaving the application.

    Returns Promise<boolean>

setChallengeId

  • setChallengeId(challenge_id: string): this
  • Parameters

    • challenge_id: string

    Returns this

setContext

  • setContext(context_id: string): this
  • Parameters

    • context_id: string

    Returns this

setDuration

  • setDuration(duration: number): this
  • Parameters

    • duration: number

    Returns this

setScore

  • setScore(score: number): this
  • Parameters

    • score: number

    Returns this

toJSON

  • toJSON(): string
  • Returns string

Generated using TypeDoc