Skip to content

API Methods

The OperatorInterface class provides static methods to communicate with the operator.

Setup

setup

Initializes the OperatorInterface.

typescript
static setup(
  operatorProtocol: OperatorProtocol,
  gameCode: string,
  currencyCode: string,
  languageCode: string,
  playerID: string,
  mode: string,
  lobbyURL: string,
  isMobile?: boolean
): Promise<void>

Parameters:

  • operatorProtocol: The operator protocol to use.
  • gameCode: The game code.
  • currencyCode: The 3-digit ISO currency code.
  • languageCode: The 2-digit ISO language code.
  • playerID: The player ID.
  • mode: The game mode (e.g., "REAL", "DEMO").
  • lobbyURL: The URL to the lobby.
  • isMobile: (Optional) Whether the game is in mobile mode. Defaults to false.

Event Handling

addEventListener

Adds a listener to a given incoming event.

typescript
static addEventListener(event: OperatorInterfaceToGameMessage, callback: Callback): Callback

Parameters:

  • event: The incoming event to listen for.
  • callback: The callback function to call.

Returns:

  • The callback function.

on

Adds a listener to a given incoming event. on is an alias for addEventListener.

typescript
static on(event: OperatorInterfaceToGameMessage, callback: Callback): Callback

Parameters:

  • event: The incoming event to listen for.
  • callback: The callback function to call.

Returns:

  • The callback function.

once

Adds a listener to a given incoming event and removes it once it's been called.

typescript
static once(event: OperatorInterfaceToGameMessage, callback: Callback): Callback

Parameters:

  • event: The incoming event to listen for.
  • callback: The callback function to call.

Returns:

  • The callback function.

removeEventListener

Removes a listener for a given event.

typescript
static removeEventListener(event: OperatorInterfaceToGameMessage, callback: Callback): void

Parameters:

  • event: The incoming event.
  • callback: The callback function to remove.

Game State

gameReady

The game should call this method when it is loaded and initialized.

typescript
static gameReady(): void

loadProgress

The game should call this so that the casino can be updated with loading progress and display progress in a loading screen.

typescript
static loadProgress(progress: number): void

Parameters:

  • progress: A number between 0 and 1 representing the loading progress (1 = 100%).

loadComplete

The game should call this when loading is completed.

typescript
static loadComplete(): void

gameDataLoaded

The game should call this method when the loadConfig call is received.

typescript
static gameDataLoaded(): void

initialGameState

The game should call this method before loading starts to notify operators if the game will be muted or not.

typescript
static initialGameState(muted: boolean): void

Parameters:

  • muted: Whether the game is muted.

retrievedStoredSettings

The game should call this method when the game has retrieved stored user settings such as mute state.

typescript
static retrievedStoredSettings(): void

gameUIUpdated

The game should call this method when the buy feature menu is opened/closed, the splash screen is shown/hidden, or the game is waiting for user confirmation.

typescript
static gameUIUpdated(buyFeatureMenuOpen: boolean, splashScreenVisible: boolean, waitingForUserConfirmation: boolean): void

Parameters:

  • buyFeatureMenuOpen: Whether the buy feature menu is open.
  • splashScreenVisible: Whether the splash screen is visible.
  • waitingForUserConfirmation: Whether the game is waiting for user confirmation.

Gameplay

autoPlayStarted

The game should call this method when the game starts autoplays.

typescript
static autoPlayStarted(): void

autoPlayFinished

The game should call this method when the game ends autoplays.

typescript
static autoPlayFinished(): void

spinAnimationStarted

The game should call this method when the spin animation starts.

typescript
static spinAnimationStarted(): void

spinAnimationStopped

The game should call this method when the spin animation ends.

typescript
static spinAnimationStopped(): void

roundStarted

The game should call this method when a new game round is started.

typescript
static roundStarted(balance: number, stake: number): void

Parameters:

  • balance: The player's balance in minor units.
  • stake: The player's stake in minor units.

roundEnded

The game should call this method when a game round is ended.

typescript
static roundEnded(balance: number, stake: number, winAmount?: number, ticketsLeftAfter?: number): void

Parameters:

  • balance: The player's balance in minor units.
  • stake: The player's stake in minor units.
  • winAmount: (Optional) The player's win amount in minor units. Defaults to 0.
  • ticketsLeftAfter: (Optional) The number of tickets left after the game round. Defaults to 0.

balanceUpdated

The game should call this method whenever the displayed balance is changed.

typescript
static balanceUpdated(realBalance: number, demoBalance?: number, bonusBalance?: number, fudgeAmount?: number): void

Parameters:

  • realBalance: The real balance of the player.
  • demoBalance: (Optional) The demo balance of the player. Defaults to 0.
  • bonusBalance: (Optional) The bonus balance of the player. Defaults to 0.
  • fudgeAmount: (Optional) How much to fudge the displayed balance (if win animations have not yet finished). Defaults to 0.

stakeUpdated

The game should call this method to update the stake displayed by the casino.

typescript
static stakeUpdated(stake: number): void

Parameters:

  • stake: The player's stake in minor units.

cashWin

The game should call this method to update the win amount displayed by the casino.

typescript
static cashWin(
  winAmount: number,
  stake: number,
  winType?: 'normal' | 'big' | 'mega' | 'monster' | 'legendary',
  isFreePlayWin?: boolean,
  totalFreePlayWin?: number
): void

Parameters:

  • winAmount: The player's win amount in minor units.
  • stake: The player's bet amount in minor units.
  • winType: (Optional) The type of win. Defaults to 'normal'.
  • isFreePlayWin: (Optional) Was the win awarded in freeplays? Defaults to false.
  • totalFreePlayWin: (Optional) What is the total win in the freeplays? Defaults to 0.

collected

The game should call this method when the player collects a win.

typescript
static collected(collectedAmount: number): void

Parameters:

  • collectedAmount: The amount the player collected in minor units.

cashier

The game should call this method when the user runs out of funds or attempts to spin with insufficient funds.

typescript
static cashier(): void

help

The game should call this method when the user requests help.

typescript
static help(): void

history

The game should call this method to navigate to game history.

typescript
static history(): void

quit

The game should call this method when the quit button is pressed.

typescript
static quit(): void

resume

The game should call this method when the game is brought back into focus.

typescript
static resume(): void

visibleSymbols

The game should call this method to notify operators of the symbols visible in the reels.

typescript
static visibleSymbols(visibleSymbols: number[][], stake: number): void

Parameters:

  • visibleSymbols: The visible symbols.
  • stake: The stake amount.

winningSymbols

The game should call this method to notify operators of the symbols included in all winlines.

typescript
static winningSymbols(symbols: number[], stake: number): void

Parameters:

  • symbols: The winning symbols.
  • stake: The stake amount.

lineCountUpdated

The game should call this method when the number of winlines changes.

typescript
static lineCountUpdated(lineCount: number): void

Parameters:

  • lineCount: The number of winlines.

cardGamble

The game should call this method when a card gamble bet is placed.

typescript
static cardGamble(): void

ladderGamble

The game should call this method when a ladder gamble bet is placed.

typescript
static ladderGamble(): void

gambleWin

The game should call this method when a win is awarded after gambling (bonus).

typescript
static gambleWin(winAmount: number, stake: number): void

Parameters:

  • winAmount: The player's win amount in minor units.
  • stake: The player's bet amount in minor units.

fullRow

The game should call this method when a full row winline is awarded.

typescript
static fullRow(rowCount: number, includesWilds: boolean, winlineSymbols: number[]): void

Parameters:

  • rowCount: The number of symbols in the winline.
  • includesWilds: Whether the winline includes a wild.
  • winlineSymbols: The symbols in the winline.

scatterWin

The game should call this method when scatters award cash.

typescript
static scatterWin(winAmount: number, scatterSymbolID: number, positions: number[][]): void

Parameters:

  • winAmount: The amount of cash the scatters awards.
  • scatterSymbolID: The ID of the symbol which awarded the scatter win.
  • positions: The position of the scatters on the reels.

Features

freeSpinsAwarded

The game should call this method when the freespins feature is awarded.

typescript
static freeSpinsAwarded(awarded: number, stake: number, inFreeSpins: boolean): void

Parameters:

  • awarded: How many freespins were awarded.
  • stake: The player's bet amount in minor units.
  • inFreeSpins: Were the freespins awarded in freespins?

featuredStarted

The game should call this method when the game enters a feature like freespins.

typescript
static featuredStarted(): void

featuredFinished

The game should call this method when the game finishes a feature like freespins.

typescript
static featuredFinished(): void

freeplaysAwarded

The game should call this method when entering freeplays.

typescript
static freeplaysAwarded(awarded: number, stake: number): void

Parameters:

  • awarded: The number of freeplays awarded.
  • stake: The stake of the freeplays in minor units.

freeplaysSummary

The game should call this method when freeplays have ended.

typescript
static freeplaysSummary(used: number, stake: number, totalWin: number): void

Parameters:

  • used: The number of freeplays used.
  • stake: The stake of the freeplays in minor units.
  • totalWin: The total win of the freeplays in minor units.

getPromoInfo

The game should call this method when the game is in freeplays.

typescript
static getPromoInfo(): void

setPromoInfo

The game should call this method when response.ticketInfo.promotions.data is present in the response.

typescript
static setPromoInfo(promoInfo: string): void

Parameters:

  • promoInfo: The promo info passed by the game engine.

registerOption

The game can call this method to notify the operator that particular game options can be displayed by the commonUI.

typescript
static registerOption(option: RegisterOption): void

Parameters:

  • option: The game option to register.

realityCheck

The game should call this method to display the reality check dialog.

typescript
static realityCheck(elapsedMS: number, intervalMS: number, exitURL: string, historyURL: string): void

Parameters:

  • elapsedMS: The elapsed time in milliseconds.
  • intervalMS: The interval between reality checks in milliseconds.
  • exitURL: The URL to redirect to when the player exits the game.
  • historyURL: The URL to redirect to when the player wants to see their history.

sendRealityCheckResponse

The game should call this method when the player responds to the reality check dialog.

typescript
static sendRealityCheckResponse(backendURL: string, token: string, continued: boolean): Promise<GameAPIReply | ErrorResponse>

Parameters:

  • backendURL: The backend URL received in login call.
  • token: The token received in the last successful call.
  • continued: Whether the player chose to continue.

Returns:

  • A promise that resolves to a GameAPIReply object on success, or an ErrorResponse on failure.

Audio & Turbo

muted

The game should call this method to notify the operator that the sound was muted.

typescript
static muted(): void

unmuted

The game should call this method to notify the operator that the sound was unmuted.

typescript
static unmuted(): void

support

The game should call this method when the user requests support.

typescript
static support(): void

turboEnabled

The game should call this method to notify the operator that turbo was enabled.

typescript
static turboEnabled(): void

turboDisabled

The game should call this method to notify the operator that turbo was disabled.

typescript
static turboDisabled(): void

Other

error

The game should call this method when an error is shown.

typescript
static error(category: ErrorCategory, severity: ErrorSeverity, message: string, code?: string): void

Parameters:

  • category: The error category.
  • severity: The severity of the error.
  • message: The message to display.
  • code: (Optional) Mandatory for Light and Wonder (LNW).

orientationUpdated

The game should call this method when orientation is updated.

typescript
static orientationUpdated(): void

passThroughMessage

The game should call this method with any messages that are passed to the frontend.

typescript
static passThroughMessage(message: string): void

Parameters:

  • message: The message to forward to the operator.

playerActivity

The game should call this method when the player performs an action in the game. This allows the lobby to control session inactivity requirements for specific jurisdictions.

Examples of actions that should trigger this method:

  • Clicking the spin button
  • Changing the bet/stake amount
  • Interacting with game menus or settings
  • Clicking collect/gamble buttons
  • Any touch or click input during gameplay
typescript
static playerActivity(): void