---
metadata:
  - name: generator
    content: Diplodoc Platform v5.55.2
alternate:
  - https://yandex.com/dev/games/doc/en/sdk/defold/events.md
  - https://yandex.com/dev/games/doc/hi/sdk/defold/events.md
  - https://yandex.com/dev/games/doc/ko/sdk/defold/events.md
  - https://yandex.com/dev/games/doc/ru/sdk/defold/events.md
  - https://yandex.com/dev/games/doc/tr/sdk/defold/events.md
  - https://yandex.com/dev/games/doc/vi/sdk/defold/events.md
  - https://yandex.com/dev/games/doc/zh/sdk/defold/events.md
  - href: ko/sdk/defold/events.md
    type: text/markdown
    title: Markdown version
  - href: ../../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/games/doc/ko/llms.txt

# 이벤트

사용자가 게임에서 특정 버튼을 누를 때 발생하는 이벤트를 추적할 수 있습니다.

사용 가능한 이벤트 및 이를 처리하기 위한 메서드는 다음과 같습니다:

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

## HISTORY_BACK

**뒤로** 버튼 클릭을 추적하려면 다음 방법을 사용합니다.

```lua
ysdk.on_event("HISTORY_BACK", function (self)
    -- 사용자에게 사용자 지정 게임 대화 상자를 표시하여 게임 종료 확인 옵션
    -- 게임 종료, 내부 설정, 상점 등으로 이동하는 것을 확인합니다
end)
```

{% note alert "알림" %}

이 이벤트는 게임이 TV에서 실행될 경우에만 사용할 수 있습니다.

{% endnote %}

## EXIT

사용자가 **뒤로**를 클릭한 후 열리는 사용자 지정 대화 상자에서 게임 종료를 확인하면 게임에서 종료 이벤트를 보내야 합니다. 이렇게 하려면 다음 방법을 사용합니다.

```lua
ysdk.dispatch_event("EXIT")
```

---



<!-- source: ko/_includes/button-git-defold.md -->
<a href="https://github.com/yandex-games-plugins/defold">
  <span class="button">저장소</span>
</a>
<!-- endsource: ko/_includes/button-git-defold.md -->
