> ## Documentation Index
> Fetch the complete documentation index at: https://dev.smile.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Loaded event

> `window.SmileUI`

This method allows you to detect when the `SmileUI` object has been loaded and is available for use on the page. A corresponding `smile-ui-loaded` DOM event is also fired when initialization has completed.

Combining these two approaches is useful for wrapping any code that makes use of the `SmileUI` object.

## Returns

This method returns an instance of the `SmileUI` object, or `null` if the `SmileUI` object has not yet finished loading.

<Info>
  An object as a return value does NOT mean that Smile UI has been initialized. To check for initialization after load, use the [`SmileUI.ready()`](/ui/events/ui-ready) method instead.
</Info>

<Panel>
  ```javascript JavaScript lines theme={null}
  if (window.SmileUI) {
    // SmileUI has loaded
  } else {
    document.addEventListener(
      "smile-ui-loaded", () => {
        // SmileUI has loaded
      }
    );
  }
  ```
</Panel>
