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, this is
    // synonymous to window.SmileUI.
  })
  .catch((err) => {
    // An error has occurred will initializing SmileUI
  });
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 rewards panel. It is useful for wrapping calls to other methods on the SmileUI object.
If your code isn’t using the Smile UI object, use the Smile.ready() method instead.

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.