Skip to main content

Events

You can track events that occur when a user presses certain buttons in the game.

Available events and methods for working with them:

ysdk = {
on_event = function (eventName: "EXIT" | "HISTORY_BACK", listener: function): nil,
dispatch_event = function (eventName: "EXIT" | "HISTORY_BACK", detail: table|nil): nil,
}

HISTORY_BACK event

To track the Back button press on the TV remote, use the method:

ysdk.on_event("HISTORY_BACK", function (self)
-- Show the user a custom game dialog with the ability
-- to confirm exiting the game, go to internal settings, shop, etc.
end)

EXIT event

If the user confirms the exit from the game in a custom dialog that opens after pressing Back on remote, the game should send an exit event. To do this, use the method:

ysdk.dispatch_event("EXIT")