> For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt.

# Function: useLynxGlobalEventListener()

> **useLynxGlobalEventListener**\<`T` _extends_ (...`args`: `any`\[]) => `void`>(`eventName`: `string`, `listener`: `T`): `void`

`useLynxGlobalEventListener` helps you `addListener` as early as possible.

## Type Parameters

| Type Parameter                                |
| --------------------------------------------- |
| `T` _extends_ (...`args`: `any`\[]) => `void` |

## Parameters

| Parameter   | Type     | Description          |
| ----------- | -------- | -------------------- |
| `eventName` | `string` | Event name to listen |
| `listener`  | `T`      | Event handler        |

## Returns

`void`

## Example

Use this hooks to listen to event 'exposure' and event 'disexposure'

```jsx
function App() {
  useLynxGlobalEventListener('exposure', (e) => {
    console.log("exposure", e)
  })
  useLynxGlobalEventListener('disexposure', (e) => {
    console.log("disexposure", e)
  })
  return (
    <view
      style='width: 100px; height: 100px; background-color: red;'
      exposure-id='a'
    />
  )
}
```
