fbsim-core JavaScript & TypeScript API - v1.0.0-beta.2
    Preparing search index...

    Class League

    A WASM-friendly wrapper around League.

    Index

    Constructors

    • Creates a new empty league.

      Returns League

    Properties

    currentSeason: any

    Returns the current season as a JSON object, or undefined if none.

    seasons: any

    Returns the past seasons as a JSON array.

    teams: any

    Returns the league teams as a JSON object (BTreeMap<usize, LeagueTeam>).

    Methods

    • Adds a conference to the current season (takes ownership).

      Parameters

      Returns void

    • Creates a new season (archives the current one if complete).

      Returns void

    • Adds a team roster to the current season.

      Parameters

      Returns void

    • Adds a new team to the league (auto-assigns an ID).

      Returns void

    • Returns void

    • Returns a specific matchup as JSON, or undefined if not found.

      Parameters

      • year: number
      • week: number
      • matchup: number

      Returns any

    • Returns a specific season by year as JSON, or undefined if not found.

      Parameters

      • year: number

      Returns any

    • Returns a specific team as a JSON object, or undefined if not found.

      Parameters

      • id: number

      Returns any

    • Returns a specific week as JSON, or undefined if not found.

      Parameters

      • year: number
      • week: number

      Returns any

    • Simulates the entire current season.

      Parameters

      Returns void

    • Simulates a single matchup of the current season. Returns game log as JSON.

      Parameters

      • week: number
      • matchup: number
      • rng: Rng

      Returns any

    • Simulates a single play of a matchup. Returns game log as JSON if the game finished on this play, or undefined if still in progress.

      Parameters

      • week: number
      • matchup: number
      • rng: Rng

      Returns any

    • Simulates a single week of the current season.

      Parameters

      • week: number
      • rng: Rng

      Returns void

    • Returns a team's total championship appearances.

      Parameters

      • id: number

      Returns number

    • Returns a team's total championship wins.

      Parameters

      • id: number

      Returns number

    • Returns all matchups for a team across all seasons as JSON.

      Parameters

      • id: number

      Returns any

    • Returns a team's all-time playoff record as JSON.

      Parameters

      • id: number

      Returns any

    • Returns all matchups for a team in a specific season as JSON.

      Parameters

      • id: number
      • year: number

      Returns any

    • Serializes the league to a JSON-compatible JS value.

      Returns any

    • Deserializes a league from a JSON-compatible JS value.

      Parameters

      • value: any

      Returns League