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

# on()

> Subscribes to a Daily call event.

`on(eventName, callback)`

<Badge color="green">{"✓"} Prebuilt</Badge> <Badge color="green">{"✓"} Custom</Badge>

Subscribes to a Daily call event. Follows the Node.js [`EventEmitter`](https://nodejs.org/api/events.html#events_class_eventemitter) interface. The callback is called every time the event fires until explicitly removed with [`off()`](/reference/daily-js/instance-methods/off).

Returns `this`, so calls can be chained.

## Parameters

<ParamField body="eventName" type="DailyEvent" required>
  The event name to subscribe to. See the [Events](/reference/daily-js/events) reference for all available events.
</ParamField>

<ParamField body="callback" type="function" required>
  Function called when the event fires. Receives an event object whose shape depends on the event.
</ParamField>

## Return value

Returns `this` (the `DailyCall` instance) for chaining.

## Example

```javascript theme={null}
call
  .on('joined-meeting', ({ participants }) => {
    console.log('Joined! Participants:', participants);
  })
  .on('participant-joined', ({ participant }) => {
    console.log('New participant:', participant.user_name);
  })
  .on('left-meeting', () => {
    console.log('Left the call');
  });
```

## See also

<CardGroup>
  <Card title="Methods" icon="code" iconType="solid">
    * [off()](/reference/daily-js/instance-methods/off)
    * [once()](/reference/daily-js/instance-methods/once)
  </Card>

  <Card title="Guides" icon="book-open" iconType="solid">
    * [Events](/docs/daily-js/concepts/events)
  </Card>
</CardGroup>
