SDK events

SDK events

In case of an error in the SDKs, custom events are fired, informing the eventId and also the reason for the error.

Types of events triggered by the SDK.

Type

Description

front_capture_started

Triggered when the capture of the front of the document has started.

back_capture_started

Triggered when the capture of the back of the document has started.

capture_invalid

Triggered when an error occurs in some validation performed by the SDK.

capture_failed

Triggered when an error occurs that is not handled by the SDK.

addEventListener(type, listener, options)

Listen to event of the informed type.

removeEventListener(type, callback, options)

Removes event listener of informed type.

Example

sdk.addEventListener("capture_invalid", (e) => console.log(e.detail));

The return will be a CustomEvent object containing the details and properties of the event.

{
  "eventId": "IS_ALIVE_FALSE",
  "error": {
    "isAlive": false
  }
}

Compatibility

  • Consult compatibility according to MDN.

Last updated

Logo

2023 © Caf. - All rights reserved