Viktorani API - v0.0.8
    Preparing search index...

    Type Alias GameEvent

    GameEvent:
        | { index: number; roundIndex: number; type: "SLIDE_CHANGE" }
        | { type: "BUZZER_LOCK" }
        | { type: "BUZZER_UNLOCK" }
        | { scores: Record<string, number>; type: "SCORE_UPDATE" }
        | { duration: number; id: string; label: string; type: "TIMER_START" }
        | { id: string; type: "TIMER_PAUSE" }
        | { id: string; type: "TIMER_RESUME" }
        | { id: string; label: string; type: "TIMER_EXPIRED" }
        | { state: SerializedGameState; type: "GAME_STATE" }
        | {
            showAnswers: boolean;
            showMedia: boolean;
            showQuestion: boolean;
            type: "VISIBILITY";
        }
        | { status: "active"
        | "paused"
        | "ended"; type: "GAME_STATUS" }

    Events broadcast by the GameMaster to all connected players.

    Type Declaration

    • { index: number; roundIndex: number; type: "SLIDE_CHANGE" }

      Instructs players to navigate to a specific question within a round.

    • { type: "BUZZER_LOCK" }

      Locks the buzzer — no new buzzes are accepted.

    • { type: "BUZZER_UNLOCK" }

      Unlocks the buzzer — players may buzz in.

    • { scores: Record<string, number>; type: "SCORE_UPDATE" }

      Updated score map keyed by player or team ID.

    • { duration: number; id: string; label: string; type: "TIMER_START" }

      Starts a new countdown timer visible to players.

    • { id: string; type: "TIMER_PAUSE" }

      Pauses the named timer.

    • { id: string; type: "TIMER_RESUME" }

      Resumes the named timer from its paused position.

    • { id: string; label: string; type: "TIMER_EXPIRED" }

      Notifies players that a timer has reached zero.

    • { state: SerializedGameState; type: "GAME_STATE" }

      Full game-state snapshot sent to newly connected players.

    • {
          showAnswers: boolean;
          showMedia: boolean;
          showQuestion: boolean;
          type: "VISIBILITY";
      }

      Toggles which parts of the current question are revealed to players.

    • { status: "active" | "paused" | "ended"; type: "GAME_STATUS" }

      Lifecycle status of the game session.

    All variants are discriminated by type. Consumers should switch on type and handle only the variants they care about.

    transport.onEvent(event => {
    if (event.type === 'SLIDE_CHANGE') {
    goToSlide(event.index)
    }
    })