Platform Parameters

At any time, you can retrieve values for specific parameters that you might use in your game, such as the user's browser language.

Platform ID

Identify the platform on which the game is currently running to customize features and settings accordingly.

bridge.platform.id

Returns the ID of the platform on which the game is currently running. Possible values: playgama, vk, ok, yandex, crazy_games, game_distribution, wortal, playdeck, vk_play, y8, mock.

Native SDK

Returns the native SDK of the platform.

bridge.platform.sdk

Language

Get the language set by the user on the platform or the browser language if not provided by the platform, to localize game content.

bridge.platform.language

If the platform provides user language data, this will be the language set by the user on the platform. If not, it will be the browser language.

Format: ISO 639-1. Example: ru, en.

URL Parameter

Embed auxiliary information into the game URL to pass additional data or settings when launching the game.

bridge.platform.payload

This parameter allows embedding auxiliary information into the game URL.

Domain Information

Retrieve the top-level domain of the platform to handle domain-specific configurations and behavior.

bridge.platform.tld

Returns the top-level domain (TLD) of the platform. If there is no data – null. If the data is available – com, ru, etc.

Sending a Message to the Platform

Send predefined messages to the platform to trigger specific actions or events, such as signaling that the game is ready.

bridge.platform.sendMessage("game_ready")

The call to sendMessage with the parameter game_ready is mandatory!

Don't forget to implement it.

Server Time

bridge.platform.getServerTime()
    .then(result => {
        console.log(result) // UTC time in milliseconds
    })
    .catch(error => {
        console.log(error)
    })

Current Visibility State

Check if the game tab is visible or hidden, and adjust game behavior accordingly, such as muting sound when hidden.

bridge.game.visibilityState
// Listen for visibility state changes
bridge.game.on(bridge.EVENT_NAME.VISIBILITY_STATE_CHANGED, state => {
    console.log('Visibility state:', state);
});

Returns the current visibility state of the game (the tab with the game). Possible values: visible, hidden.

React to visibility state changes. For example, mute the game sound when hidden and unmute when visible.

Last updated