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

# EmitterEvents Type

> EmitterEvents type represents the events that can be emitted by the web SDK

EmitterEvents type represents the events the Web SDK emits to monitor session state and handle responses. The code snippet below shows how to use the `EmitterEvents` type to create an emitter events object.

Version `2.0.4` of the Suki Web SDK updates the `EmitterEvents` type. Use these events to track granular details for authentication processes and ambient session lifecycles.

## Authentication events

The web SDK supports **six new auth events** that allow you to monitor registration and token refreshes:

<Expandable title="authentication events" defaultOpen="true">
  <ResponseField name="login:success" type="never">
    Emitted when a user is successfully authenticated
  </ResponseField>

  <ResponseField name="login:fail" type="SukiError">
    Emitted when a user authentication fails
  </ResponseField>

  <ResponseField name="register:success" type="never">
    Emitted when a user is successfully registered
  </ResponseField>

  <ResponseField name="register:fail" type="SukiError">
    Emitted when a user registration fails
  </ResponseField>

  <ResponseField name="token-refresh:success" type="never">
    Emitted when a user token is successfully refreshed
  </ResponseField>

  <ResponseField name="token-refresh:fail" type="SukiError">
    Emitted when a user token refresh fails
  </ResponseField>
</Expandable>

## Ambient events

<Expandable title="ambient events" defaultOpen="true">
  The web SDK supports **five new ambient events** that allow you to monitor the ambient session lifecycle:

  <ResponseField name="ambient:start" type="object">
    Emitted when a new ambient session is started
  </ResponseField>

  <ResponseField name="ambient:pause" type="object">
    Emitted when the ambient session is paused
  </ResponseField>

  <ResponseField name="ambient:resume" type="object">
    Emitted when the ambient session is resumed
  </ResponseField>

  <ResponseField name="ambient:cancel" type="object">
    Emitted when the ambient session is cancelled
  </ResponseField>

  <ResponseField name="ambient:submit" type="object">
    Emitted when the ambient session is submitted
  </ResponseField>
</Expandable>

These additional events will help you monitor the state of the ambient session and handle responses accordingly.

```js JavaScript expandable theme={"theme":{"light":"github-dark","dark":"material-theme-darker"}}
type EmitterEvents = {
  ready: never;
  "init:change": boolean;
  close: never;
  // login events supported by the Web SDK
  "login:success": never; // [!code ++:6] New in v2.0.4
  "login:fail": SukiError;
  "register:success": never; 
  "register:fail": SukiError;
  "token-refresh:success": never;
  "token-refresh:fail": SukiError;
  "ambient:update": {
    ambientId: string;
    isAmbientInProgress: boolean;
    isAmbientPaused: boolean;
  };
  // lifecycle events supported by the Web SDK
  "ambient:start": { // [!code ++:15] New in v2.0.4
    ambientId: string;
  },
  "ambient:pause": {
    ambientId: string;
  },
  "ambient:resume": {
    ambientId: string;
  },
  "ambient:cancel": {
    ambientId: string;
  },
  "ambient:submit": {
    ambientId: string;
  },
  "note-submission:success": {
    noteId: string;
    encounterId: string;
    contents: Array<{ title: string; content: NoteContent }>;
  };
  error: SukiError;
};
```

<Tip>
  To identify the `SukiError` from above events, refer to the [error codes](/web-sdk/api-reference/types/suki-error#errorcode-identifier) section for more information.
</Tip>

## Properties

<Expandable title="properties" defaultOpen="true">
  <ResponseField name="ambient:update" type="object">
    Emitted when ambient session state changes
  </ResponseField>

  <ResponseField name="close">
    Emitted when the SDK is closed
  </ResponseField>

  <ResponseField name="error" type="SukiError">
    Emitted when an error occurs. Refer to the [SukiError](/web-sdk/api-reference/types/suki-error) page for more information.
  </ResponseField>

  <ResponseField name="init:change" type="boolean">
    Emitted when initialization state changes
  </ResponseField>

  <ResponseField name="note-submission:success" type="object">
    Emitted when a note is successfully submitted
  </ResponseField>

  <ResponseField name="ready">
    Emitted when the SDK is ready for use
  </ResponseField>
</Expandable>
