> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nmbr.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Events

> The Nmbr Component broadcasts events that your app can listen for

The Nmbr Component currently broadcasts a limited number of lifecycle/domain events related to payroll and user navigation. Your
application can listen for and react to these events in order to add your own UX experiences within your app.

## Events

| Name             | Description                                                                        | Data                                                                                                           |
| ---------------- | ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `payroll-review` | Broadcasted when the user reaches the "review" step of the payroll run experience. | `{ data: { id: string}}`, where `id` corresponds to the ID of the payroll currently being reviewed by the user |

## API

To listen and react to events, you need to use the `on` and `off` API available on `window.nmbr`.

The first argument to `on`/`off` must be the name of the event you want to listen for, and the second argument must be a function that will execute when the event is broadcasted.

```typescript theme={null}
function alertUser(event, data) {
  window.alert(
    `CALLBACK 1: payroll-review event fired with id: ${data.data.id}`,
  );
}

// To subscribe to events via `nmbr.on`:
window.nmbr.on('payroll-review', alertUser);

// To unsubscribe from events via `nmbr.off`:
window.nmbr.off('payroll-review', alertUser);
```
