> For the complete documentation index, see [llms.txt](https://www.robotmon.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.robotmon.app/jiao-ben-jiao-xue/api-documents/javascript-events.md).

# JavaScript Events

Add the following `<script>` in the `<head>` section of `index.html`

`start()` and `stop()` should defined in `index.js`

```
<script>
  function onEvent(eventType) {
    if (eventType == 'OnPlayClick') {
      JavaScriptInterface.runScript(`start();`);
    } else if (eventType == 'OnPauseClick') {
      JavaScriptInterface.runScript('stop();');
    }
  }

  function onLog(message) {
    console.log(message);
  }
</script>
```

| **Event name** |
| -------------- |
| OnMenuClick    |
| OnPlayClick    |
| OnPauseClick   |
| OnLogClick     |
| OnSettingClick |
| OnCloseClick   |
