New In 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:
Hide authentication events
Emitted when a user is successfully authenticated
Emitted when a user authentication fails
Emitted when a user is successfully registered
Emitted when a user registration fails
Emitted when a user token is successfully refreshed
Emitted when a user token refresh fails
Ambient Events
The web SDK supports five new ambient events that allow you to monitor the ambient session lifecycle: Emitted when a new ambient session is started
Emitted when the ambient session is paused
Emitted when the ambient session is resumed
Emitted when the ambient session is cancelled
Emitted when the ambient session is submitted
These addtional events will help you monitor the state of the ambient session and handle responses accordingly.
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 ;
};
See all 38 lines
To identify the SUKIError from above events, refer to the error codes section for more information.
Properties
Emitted when ambient session state changes
Emitted when the SDK is closed
Emitted when an error occurs. Refer to the SukiError page for more information. Emitted when initialization state changes
Emitted when a note is successfully submitted
Emitted when the SDK is ready for use