> For the complete documentation index, see [llms.txt](https://scripting.breeze.rip/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://scripting.breeze.rip/api/functions/script.addlistener.md).

# script.addListener

> **addListener**<`K`>(`event`, `listener`): `void`

Add an event listener to the script.

### Type Parameters

#### K

`K` *extends* keyof `EventMap`

### Parameters

#### event

`K`

The event to listen to.

#### listener

(`e`) => `void`

The function to call when the event is fired.

### Returns

`void`

### Remarks

This can only be used while the script is initializing.

### Example

```ts
script.addListener("Render3DEvent", (event) => {
  // ...
});
```
