# On JavaScript Callback

## Overview

![The On JavaScript Callback Node.](https://2561100106-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ff6JZovzOqBctA4C1o76u%2Fuploads%2Fgit-blob-db325371356f07e9420ea4484a60fed077044773%2Fonjavascriptcallbackupdatedimage.png?alt=media)

**On JavaScript Callback** is an **Event Listener** **Node** used for executing a **Logic Branch** when a JavaScript function is called. This function needs to be defined in the **Web Sprite** that is given as **Object** **Attribute**.

[**Scope**](https://docs.incari.com/incari-studio/2023.2/overview#scopes): **Scene**, **Prefab**.

## Attributes

![The On JavaScript Callback Node.](https://2561100106-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ff6JZovzOqBctA4C1o76u%2Fuploads%2Fgit-blob-d9089d22536b202a3edf2b839e3834f7698e1022%2Fjavascriptcallbackattributes%20-%20Copy.png?alt=media)

### Object

| Attribute | Type         | Description                                                                                                          |
| --------- | ------------ | -------------------------------------------------------------------------------------------------------------------- |
| `Object`  | **ObjectID** | **Web Sprite** **Object** that contains the callback function, if none is given in the `Object ID` **Input Socket**. |

### Function

| Attribute          | Type       | Description                                                                                                         |
| ------------------ | ---------- | ------------------------------------------------------------------------------------------------------------------- |
| `JS Function Name` | **String** | The name of the function that will trigger the **Logic**, if none is given in the `Function name` **Input Socket**. |

### Outputs

#### Data Types

| Attribute        | Type          | Description                                                         |
| ---------------- | ------------- | ------------------------------------------------------------------- |
| `Data Types [n]` | **Drop-down** | Label and **Data Type** of the corresponding **Output** **Socket**. |

## Inputs

| Input           | Type         | Description                                                                        |
| --------------- | ------------ | ---------------------------------------------------------------------------------- |
| `Object ID`     | **ObjectID** | **Web Sprite** **Object** that contains the callback function.                     |
| `Function name` | **String**   | The name of the function that will trigger the **Logic**.                          |
| `Subscribe` (►) | **Pulse**    | An **Input Pulse** that needs to be triggered to start listening to the **Event**. |

## Outputs

| Output             | Type                                         | Description                                                                                                                            |
| ------------------ | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| *Pulse Output* (►) | **Pulse**                                    | A standard **Output Pulse**, to move onto the next **Node** along the **Logic Branch**, once this **Node** has finished its execution. |
| `Parameter`        | *Defined in the `Data Type`* ***Attribute*** | Parameter received by the callback function.                                                                                           |
| `Object ID`        | **ObjectID**                                 | **Web Sprite** **Object** received as **Input**.                                                                                       |

## See Also

* [**Call JavaScript Function**](https://docs.incari.com/incari-studio/2023.2/toolbox/web/call-javascript-function)
