Skip to main content
JavaScript
SmileUI.ready()
  .then((smileUiInstance) => {
    // Smile UI has been fully initialized
    // and is ready to be used. smileUiInstance
    // is an instance of the initialized
    // variable and is synonymous with
    // window.SmileUI
  })
  .catch((err) => {
    // An error has occurred while initializing
  });
This method is used to detect when Smile UI and it’s dependencies have been fully initialized and are ready to be interacted with on the page. This includes identifying the logged-in customer and loading up the loyalty panel. It is useful for wrapping calls to other methods on the SmileUI object.

Returns

This method returns a Promise that resolves once Smile UI and it’s dependencies have been fully initialized. If initialization has already occurred, the Promise will resolve immediately. The Promise will resolve with:
  • On success, an initialized instance of the SmileUI object.
  • On failure, an error object.