Event listeners

Event listeners are JavaScript methods that set up a function to run whenever the specified event is delivered to the target.

You can use event listeners to provide UI feedback to your end-users, handle retries, and more. Since custom events do not support callbacks, event listeners give you access to the current status (loading, success, error) of any action carried out.

didomi:save-pending-consents-loading

didomi:save-pending-consents-loading is triggered when the "save pending consents" action is waiting for SDK response.

document.addEventListener("didomi:save-pending-consents-loading", () => {
  // your callback
});

didomi:save-pending-consents-error

didomi:save-pending-consents-error is triggered when saving pending consents fails.

document.addEventListener("didomi:save-pending-consents-error", () => {
  // your callback
});

didomi:save-pending-consents-success

didomi:save-pending-consents-success is triggered when saving pending consents succeeds.

document.addEventListener("didomi:save-pending-consents-success", () => {
  // your callback
});

didomi:set-consents-loading

didomi:set-consents-loading is triggered when saving consents is waiting for SDK response.

document.addEventListener("didomi:set-consents-loading", () => {
  // your callback
});

didomi:set-consents-error

didomi:set-consents-error is triggered when saving consents fails.

document.addEventListener("didomi:set-consents-error", () => {
  // your callback
});

didomi:set-consents-success

didomi:set-consents-success is triggered when saving consents succeeds.

document.addEventListener("didomi:set-consents-success", function);

didomi:send-authentication-loading

didomi:send-authentication-loading is triggered when authentication is waiting for SDK response.

document.addEventListener("didomi:send-authentication-loading", () => {
  // your callback
});

didomi:send-authentication-success

didomi:send-authentication-success is triggered when authentication succeeds.

document.addEventListener("didomi:send-authentication-success", () => {
  // your callback
});

didomi:send-authentication-error

didomi:send-authentication-error is triggered when authentication fails.

document.addEventListener("didomi:send-authentication-error", () => {
  // your callback
});

didomi:verify-otp-code-loading

didomi:verify-otp-code-loading is triggered when authentication is waiting for SDK response.

document.addEventListener("didomi:verify-otp-code-loading", () => {
  // your callback
});

didomi:verify-otp-code-success

didomi:verify-otp-code-success is triggered when authentication succeeds.

document.addEventListener("didomi:verify-otp-code-success", () => {
  // your callback
});

didomi:verify-otp-code-error

didomi:verify-otp-code-error is triggered when authentication fails.

document.addEventListener("didomi:verify-otp-code-error", () => {
  // your callback
});

didomi:init-authentication-error

didomi:init-authentication-error is triggered when the authentication initiate function fails while SDK is loading.

document.addEventListener("didomi:init-authentication-error", () => {
  // your callback
});

Last updated