Contents

evaluate(inJavaScriptContext:completion:)

Evaluates a block in the JavaScript execution queue.

Declaration

func evaluate(inJavaScriptContext evaluation: @escaping (JSContext) -> Void, completion: (@Sendable (Bool) -> Void)? = nil)
func evaluate(inJavaScriptContext evaluation: @escaping (JSContext) -> Void) async -> Bool

Parameters

  • evaluation:

    The block to be evaluated in the JavaScript execution queue.

  • completion:

    The callback after the block has been executed. True if the block was evaluated; False otherwise.

Discussion

This method adds a block to the JavaScript execution queue and invokes the completion block after the evaluation block has finished execution. The context block parameter is valid within the scope of the evaluation block and should not be referenced by the app outside the block.

See Also

Controlling and Handling Events