<!--
{
  "availability" : [
    "tvOS: 9.0.0 - 18.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "TVMLKit",
  "identifier" : "/documentation/TVMLKit/TVApplicationControllerDelegate/appController(_:evaluateAppJavaScriptIn:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "TVMLKit"
    ],
    "preciseIdentifier" : "c:objc(pl)TVApplicationControllerDelegate(im)appController:evaluateAppJavaScriptInContext:"
  },
  "title" : "appController(_:evaluateAppJavaScriptIn:)"
}
-->

# appController(_:evaluateAppJavaScriptIn:)

Tells the delegate to add JavaScript classes and objects.

```
optional func appController(_ appController: TVApplicationController, evaluateAppJavaScriptIn jsContext: JSContext)
```

## Parameters

`appController`

The [`TVApplicationController`](/documentation/TVMLKit/TVApplicationController) object that is evaluating the JavaScript context.

`jsContext`

The <doc://com.apple.documentation/documentation/JavaScriptCore/JSContext> object being evaluated.

## Discussion

This method serves as a callback function, giving the delegate the ability to add JavaScript classes and objects through the <doc://com.apple.documentation/documentation/Foundation/NSMutableDictionary/setObject(_:forKey:)> method using the `jsContext` parameter. This method is called before the JavaScript is parsed into the execution context and is called on the JavaScript execution thread, not the main thread. Any object exposed to <doc://com.apple.documentation/documentation/JavaScriptCore/JSContext> must not be retained on any other thread.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)