Calling Javascript Functions 
The evaluateJavascript method allows you to execute JavaScript code from Swift in your enClose application. You can target either the main web view or an external display's web view for evaluation.
Function Syntax 
swift
evaluateJavascript(javaScript: String, target: TargetWebView = .main)Parameters 
| Parameter | Type | Required | Description | 
|---|---|---|---|
| javaScript | String | Yes | JavaScript code to be evaluated | 
| target | TargetWebView | No | Target web view for evaluation (defaults to .main) | 
Example Usage 
This example displays a simple alert on the main web view:
swift
evaluateJavascript("alert('Hello World!');)")This example toggles color inversion on the external display's web view:
swift
evaluateJavascript("""
    const body = document.body;
    const currentFilter = body.style.filter;
    if (currentFilter === 'invert(100%)') {
        body.style.filter = '';
    } else {
        body.style.filter = 'invert(100%)';
    }
    """,
    .external
)