Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Boardgame

The public definition of the boardgame object that gets attached to the window. I.e. it's accessed via window.boardgame.

Hierarchy

  • Boardgame

Index

Properties

games

games: Readonly<GameCollection>

A collection of functions used to start games in the Haskell model.

initialized

initialized: Promise<void>

A Promise that resolves once the Haskell model is ready.

Methods

addEventListener

  • addEventListener<T>(eventName: T, f: { gameOver: ((p: 1 | 2, info: any[]) => void)[]; invalidInput: (() => void)[]; invalidMove: (() => void)[]; state: ((s: any) => void)[]; turn: ((p: 1 | 2) => void)[] }[T][number]): void
  • Adds a function that listens to events from the Haskell model.

    Type parameters

    • T: "state" | "turn" | "invalidInput" | "invalidMove" | "gameOver"

    Parameters

    • eventName: T

      The event to listen to.

    • f: { gameOver: ((p: 1 | 2, info: any[]) => void)[]; invalidInput: (() => void)[]; invalidMove: (() => void)[]; state: ((s: any) => void)[]; turn: ((p: 1 | 2) => void)[] }[T][number]

      The callback function.

    Returns void

inputMove

  • inputMove(c: any): void
  • Sends a move to the Haskell model.

    Parameters

    • c: any

      The "coordinate" of the move.

    Returns void

removeEventListener

  • removeEventListener<T>(eventName: T, f: { gameOver: ((p: 1 | 2, info: any[]) => void)[]; invalidInput: (() => void)[]; invalidMove: (() => void)[]; state: ((s: any) => void)[]; turn: ((p: 1 | 2) => void)[] }[T][number]): void
  • Removes a previously added event listener.

    Type parameters

    • T: "state" | "turn" | "invalidInput" | "invalidMove" | "gameOver"

    Parameters

    • eventName: T

      The event to listen to.

    • f: { gameOver: ((p: 1 | 2, info: any[]) => void)[]; invalidInput: (() => void)[]; invalidMove: (() => void)[]; state: ((s: any) => void)[]; turn: ((p: 1 | 2) => void)[] }[T][number]

      The callback function.

    Returns void

Generated using TypeDoc