---
title: "appController(_:evaluateAppJavaScriptIn:)"
framework: tvmlkit
role: symbol
role_heading: Instance Method
path: "tvmlkit/tvapplicationcontrollerdelegate/appcontroller(_:evaluateappjavascriptin:)"
---

# appController(_:evaluateAppJavaScriptIn:)

Tells the delegate to add JavaScript classes and objects.

## Declaration

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

## Parameters

- `appController`: The doc://com.apple.tvmlkit/documentation/TVMLKit/TVApplicationController object that is evaluating the JavaScript context.
- `jsContext`: The doc://com.apple.documentation/documentation/JavaScriptCore/JSContext object being evaluated.

## Discussion

Discussion This method serves as a callback function, giving the delegate the ability to add JavaScript classes and objects through the 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 JSContext must not be retained on any other thread.

## See Also

### Managing the App Controller

- [appController(_:didFail:)](tvmlkit/tvapplicationcontrollerdelegate/appcontroller(_:didfail:).md)
- [appController(_:didFinishLaunching:)](tvmlkit/tvapplicationcontrollerdelegate/appcontroller(_:didfinishlaunching:).md)
- [appController(_:didStop:)](tvmlkit/tvapplicationcontrollerdelegate/appcontroller(_:didstop:).md)
- [player(for:)](tvmlkit/tvapplicationcontrollerdelegate/player(for:).md)
