---
updatedAt: 2025-06-16T21:15:11.000Z
---

Fetch the complete documentation index at: https://docs.ultralig.ht/llms.txt. Use this file to discover all available pages before exploring further.

# About JavaScript Interop

Ultralight is built on JavaScriptCore-- the same high-performance JavaScript engine used by Safari/WebKit on macOS and iOS.

We expose low-level C bindings to JavaScriptCore so that you can seamlessly integrate your native code with JavaScript running on a page.

> 📘 C++ Wrapper for JavaScriptCore
>
> We offer a wrapper to simplify usage from C++. See [JSHelpers.h in the AppCore API](https://ultralig.ht/api/cpp/1_4_0/_j_s_helpers_8h_source.html)

## Using the JavaScriptCore API

To use the JavaScriptCore API in your code, just include `<JavaScriptCore/JavaScript.h>`:

```c
#include <JavaScriptCore/JavaScript.h>
```

You can browse the API headers for JavaScriptCore [by clicking here](https://github.com/ultralight-ux/Ultralight-API/tree/master/JavaScriptCore).

## Common API Types

<Table align={["left","left"]}>
  <thead>
    <tr>
      <th>
        API Type
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        **JSContextRef**
      </td>

      <td>
        A JavaScript execution context, you will need this to make most calls in JavaScriptCore.
      </td>
    </tr>

    <tr>
      <td>
        **JSValueRef**
      </td>

      <td>
        The base type for all JavaScript values (eg, `Number`, `String`, `Object`, `Boolean`, etc.).  

        **This is a garbage-collected type.**
      </td>
    </tr>

    <tr>
      <td>
        **JSObjectRef**
      </td>

      <td>
        A JavaScript object-- this value is technically typedef'd to the same underlying type as `JSValueRef` and can be passed anywhere that accepts a `JSValueRef`.  

        **This is a garbage-collected type.**
      </td>
    </tr>

    <tr>
      <td>
        **JSStringRef**
      </td>

      <td>
        A raw UTF-16 string buffer for passing strings to/from JavaScript.
      </td>
    </tr>

    <tr>
      <td>
        **JSClassDefinition**
      </td>

      <td>
        Used to create custom JavaScript objects that wrap native objects.
      </td>
    </tr>
  </tbody>
</Table>