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-letter ISO currency code.
  • languageCode: The 2-letter 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. The method removes the listener after the first call.

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

Call this method after the game loads and initializes.

typescript
static gameReady(): void

loadProgress

Call this method to update the casino with the loading progress. The casino displays the 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

Call this method when loading is complete.

typescript
static loadComplete(): void

gameDataLoaded

Call this method when the game receives the loadConfig call.

typescript
static gameDataLoaded(): void

initialGameState

Call this method before loading starts. It tells the operator whether the game will be muted.

typescript
static initialGameState(muted: boolean): void

Parameters:

  • muted: Whether the game is muted.

retrievedStoredSettings

Call this method after the game retrieves stored user settings, such as the mute state.

typescript
static retrievedStoredSettings(): void

gameUIUpdated

Call this method when the buy feature menu opens or closes. Also call it when the splash screen appears or disappears, or when the game waits 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

Call this method when the game starts autoplay.

typescript
static autoPlayStarted(): void

autoPlayFinished

Call this method when the game ends autoplay.

typescript
static autoPlayFinished(): void

spinAnimationStarted

Call this method when the spin animation starts.

typescript
static spinAnimationStarted(): void

spinAnimationStopped

Call this method when the spin animation ends.

typescript
static spinAnimationStopped(): void

roundStarted

Call this method when a new gameround starts.

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

Call this method when a gameround ends.

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 gameround. Defaults to 0.

balanceUpdated

Call this method whenever the displayed balance changes.

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

Call this method to update the stake that the casino displays.

typescript
static stakeUpdated(stake: number): void

Parameters:

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

cashWin

Call this method to update the win amount that the casino displays.

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) Whether the game awarded the win during freeplays. Defaults to false.
  • totalFreePlayWin: (Optional) The total win during freeplays. Defaults to 0.

collected

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

Call this method when the user runs out of funds, or attempts to spin with insufficient funds.

typescript
static cashier(): void

help

Call this method when the user requests help.

typescript
static help(): void

history

Call this method to navigate to the game history.

typescript
static history(): void

quit

Call this method when the user presses the quit button.

typescript
static quit(): void

resume

Call this method when the game regains focus.

typescript
static resume(): void

visibleSymbols

Call this method to tell the operator which symbols are visible on the reels.

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

Parameters:

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

winningSymbols

Call this method to tell the operator which symbols appear in all winlines.

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

Parameters:

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

lineCountUpdated

Call this method when the number of winlines changes.

typescript
static lineCountUpdated(lineCount: number): void

Parameters:

  • lineCount: The number of winlines.

cardGamble

Call this method when the player places a card gamble bet.

typescript
static cardGamble(): void

ladderGamble

Call this method when the player places a ladder gamble bet.

typescript
static ladderGamble(): void

gambleWin

Call this method when the game awards a win after a gamble (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

Call this method when the game awards a full row winline.

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

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

Call this method when the game awards the free spins feature.

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

Parameters:

  • awarded: The number of free spins the game awarded.
  • stake: The player's bet amount in minor units.
  • inFreeSpins: Whether the game awarded the free spins during free spins.

featuredStarted

Call this method when the game enters a feature, such as free spins.

typescript
static featuredStarted(): void

featuredFinished

Call this method when the game finishes a feature, such as free spins.

typescript
static featuredFinished(): void

freeplaysAwarded

Call this method when the game enters 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

Call this method when freeplays end.

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

Call this method while the game is in freeplays.

typescript
static getPromoInfo(): void

setPromoInfo

Call this method when the response contains response.ticketInfo.promotions.data.

typescript
static setPromoInfo(promoInfo: string): void

Parameters:

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

registerOption

You can call this method to tell the operator that the commonUI can display specific game options.

typescript
static registerOption(option: RegisterOption): void

Parameters:

  • option: The game option to register.

realityCheck

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

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 the 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

Call this method to tell the operator that the sound is now muted.

typescript
static muted(): void

unmuted

Call this method to tell the operator that the sound is now unmuted.

typescript
static unmuted(): void

support

Call this method when the user requests support.

typescript
static support(): void

turboEnabled

Call this method to tell the operator that turbo is now enabled.

typescript
static turboEnabled(): void

turboDisabled

Call this method to tell the operator that turbo is now disabled.

typescript
static turboDisabled(): void

Other

error

Call this method when the game shows an error.

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, except required for Light and Wonder (LNW).)

orientationUpdated

Call this method when the orientation changes.

typescript
static orientationUpdated(): void

passThroughMessage

Call this method with each message that the frontend receives.

typescript
static passThroughMessage(message: string): void

Parameters:

  • message: The message to forward to the operator.

playerActivity

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 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