Skip to main content
JavaScript
document.addEventListener(
  'smile-js-loaded', () => {
    // SDK is loaded and is ready to initialize
  }
);
This event is dispatched when the SDK script finishes loading and the Smile object becomes available in the global scope. In general, you can expect this event to be dispatched before the smile-js-initialized event.

When to use

Listen for this event when loading the SDK asynchronously to ensure the SDK is ready before calling Smile.initialize(). This is particularly useful when the SDK script tag has the async attribute.

Good to know

  • This event is dispatched automatically when the SDK module loads.
  • It fires only once per page load.
  • If you’re loading the script synchronously, you don’t need to listen for this event.
  • The event is dispatched before any SDK methods are called.