Skip to main content
on(eventName, callback) Subscribes to a Daily call event. Follows the Node.js EventEmitter interface. The callback is called every time the event fires until explicitly removed with off(). Returns this, so calls can be chained.

Parameters

eventName
DailyEvent
required
The event name to subscribe to. See the Events reference for all available events.
callback
function
required
Function called when the event fires. Receives an event object whose shape depends on the event.

Return value

Returns this (the DailyCall instance) for chaining.

Example

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

Methods

Guides