Skip to main content
NewIn v2.0.4 of web SDK: 6 new auth events and 5 new ambient events have been added to the EmitterEvents type.

Overview

EmitterEvents type represents the events that can be emitted by the web SDK for monitoring session state and handling responses. The code snippet below shows how to use the EmitterEvents type to create a emitter events object. Version 2.0.4 of the Suki Web SDK updates the EmitterEvents type. You can now 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:

Ambient Events

These addtional events will help you monitor the state of the ambient session and handle responses accordingly.
JavaScript
type EmitterEvents = {
  ready: never;
  "init:change": boolean;
  close: never;
  // login events supported by the Web SDK
  "login:success": never; // 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": { // 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;
    contents: Array<{ title: string; content: NoteContent }>;
  };
  error: SukiError;
};
To identify the SUKIError from above events, refer to the error codes section for more information.

Properties